code: def time_to_seconds(x):
      
      if isinstance(x, time):
          return ((((x.hour * 60) + x.minute) * 60 + x.second) * 10**6 +
                  x.microsecond) / 10**6
  
      if is_str(x):
          return x
      # Clamp to valid time
      return x and max(0, min(x, 24 * 3600 - 10**-6))
docs: Convert a time in a seconds sum