code: def parse_time(val, fmt=None):
    
    if isinstance(val, time):
      return val
    else:
      return parse_datetime(val, fmt).time()
docs: Returns a time object parsed from :val:.
  
    :param val: a string to be parsed as a time
    :param fmt: a format string, a tuple of format strings, or None. If None a built in list of format
                strings will be used to try to parse the time.