def to_aware_utc_dt(dt):
 if (not isinstance(dt, datetime)):
  raise TypeError('Arg must be type datetime')
 if (dt.tzinfo is None):
  return pytz.utc.localize(dt)
 return dt.astimezone(pytz.utc)

def to_aware_utc_dt ( dt ) : if ( not isinstance ( dt , datetime ) ) : raise TypeError ( 'Arg must be type datetime' ) if ( dt . tzinfo is None ) : return pytz . utc . localize ( dt ) return dt . astimezone ( pytz . utc )
convert an inbound datetime into a timezone aware datetime in utc as follows: if inbound is naive .