code: def _parse_datetime(val, fmt=None):
    
    if fmt is None:
      fmt = _DEFAULT_FORMATS
  
    if isinstance(fmt, str):
      return datetime.strptime(val, fmt)
    else:
      for opt in fmt:
        try:
          return _parse_datetime(val, opt)
        except ValueError:
          continue
      raise ValueError("Unable to parse string '{}' as a timestamp".format(val))
docs: Returns a datetime object parsed from :val:. The timezone, if any, on the
    string must be in the format that python can parse.
  
    :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 datetime.