def _get_dt_and_tzinfo(dt_or_tzinfo):
 if (dt_or_tzinfo is None):
  dt = datetime.now()
  tzinfo = LOCALTZ
 elif isinstance(dt_or_tzinfo, string_types):
  dt = None
  tzinfo = get_timezone(dt_or_tzinfo)
 elif isinstance(dt_or_tzinfo, integer_types):
  dt = None
  tzinfo = UTC
 elif isinstance(dt_or_tzinfo, (datetime, time)):
  dt = _get_datetime(dt_or_tzinfo)
  if (dt.tzinfo is not None):
   tzinfo = dt.tzinfo
  else:
   tzinfo = UTC
 else:
  dt = None
  tzinfo = dt_or_tzinfo
 return (dt, tzinfo)

def _get_dt_and_tzinfo ( dt_or_tzinfo ) : if ( dt_or_tzinfo is None ) : dt = datetime . now ( ) tzinfo = LOCALTZ elif isinstance ( dt_or_tzinfo , string_types ) : dt = None tzinfo = get_timezone ( dt_or_tzinfo ) elif isinstance ( dt_or_tzinfo , integer_types ) : dt = None tzinfo = UTC elif isinstance ( dt_or_tzinfo , ( datetime , time ) ) : dt = _get_datetime ( dt_or_tzinfo ) if ( dt . tzinfo is not None ) : tzinfo = dt . tzinfo else : tzinfo = UTC else : dt = None tzinfo = dt_or_tzinfo return ( dt , tzinfo )
parse a dt_or_tzinfo value into a datetime and a tzinfo .