code: def get_t_factor(t1, t2):
      
      t_factor = None
      if t1 is not None and t2 is not None and t1 != t2:  
          dt = t2 - t1
          year = timedelta(days=365.25)
          t_factor = abs(dt.total_seconds() / year.total_seconds()) 
      return t_factor
docs: Time difference between two datetimes, expressed as decimal year