def get_time_display(dtime, format_string=None, coerce_tz=None):
 if ((dtime is not None) and (dtime.tzinfo is not None) and coerce_tz):
  try:
   to_tz = timezone(coerce_tz)
  except UnknownTimeZoneError:
   to_tz = utc
  dtime = to_tz.normalize(dtime.astimezone(to_tz))
 if ((dtime is None) or (format_string is None)):
  return get_default_time_display(dtime)
 try:
  return unicode(strftime_localized(dtime, format_string))
 except ValueError:
  return get_default_time_display(dtime)

def get_time_display ( dtime , format_string = None , coerce_tz = None ) : if ( ( dtime is not None ) and ( dtime . tzinfo is not None ) and coerce_tz ) : try : to_tz = timezone ( coerce_tz ) except UnknownTimeZoneError : to_tz = utc dtime = to_tz . normalize ( dtime . astimezone ( to_tz ) ) if ( ( dtime is None ) or ( format_string is None ) ) : return get_default_time_display ( dtime ) try : return unicode ( strftime_localized ( dtime , format_string ) ) except ValueError : return get_default_time_display ( dtime )
converts a datetime to a string representation .