def _ToTimeZone(t, tzinfo):
 if (pytz is None):
  return t.replace(tzinfo=tzinfo)
 elif tzinfo:
  if (not t.tzinfo):
   t = pytz.utc.localize(t)
  return tzinfo.normalize(t.astimezone(tzinfo))
 elif t.tzinfo:
  return pytz.utc.normalize(t.astimezone(pytz.utc)).replace(tzinfo=None)
 else:
  return t

def _ToTimeZone ( t , tzinfo ) : if ( pytz is None ) : return t . replace ( tzinfo = tzinfo ) elif tzinfo : if ( not t . tzinfo ) : t = pytz . utc . localize ( t ) return tzinfo . normalize ( t . astimezone ( tzinfo ) ) elif t . tzinfo : return pytz . utc . normalize ( t . astimezone ( pytz . utc ) ) . replace ( tzinfo = None ) else : return t
converts t to the time zone tzinfo .