code: def parse_datetime(val, fmt=None):
    
    if isinstance(val, datetime):
      return val
    else:
      return _parse_datetime(_normalize_tz(str(val)), fmt)
docs: Returns a datetime object parsed from :val:.
  
    :param val: a string to be parsed as a date
    :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 date.