code: def convert_time(obj):
      
      if not PY2 and isinstance(obj, (bytes, bytearray)):
          obj = obj.decode('ascii')
  
      m = TIME_RE.match(obj)
      if not m:
          return obj
  
      try:
          groups = list(m.groups())
          groups[-1] = _convert_second_fraction(groups[-1])
          hours, minutes, seconds, microseconds = groups
          return datetime.time(hour=int(hours), minute=int(minutes),
                               second=int(seconds), microsecond=int(microseconds))
      except ValueError:
          return obj
docs: Returns a TIME column as a time object:
  
        >>> time_or_None('15:06:17')
        datetime.time(15, 6, 17)
  
      Illegal values are returned as None:
  
        >>> time_or_None('-25:06:17') is None
        True
        >>> time_or_None('random crap') is None
        True
  
      Note that MySQL always returns TIME columns as (+|-)HH:MM:SS, but
      can accept values as (+|-)DD HH:MM:SS. The latter format will not
      be parsed correctly by this function.
  
      Also note that MySQL's TIME column corresponds more closely to
      Python's timedelta and not time. However if you want TIME columns
      to be treated as time-of-day and not a time offset, then you can
      use set this function as the converter for FIELD_TYPE.TIME.