def iso_time_string(val, show_tzinfo=False):
 if (not val):
  return ''
 if isinstance(val, six.string_types):
  dt = _parse_datetime_string(val)
 else:
  dt = val
 if (not isinstance(dt, datetime.datetime)):
  dt = datetime.datetime.fromordinal(dt.toordinal())
 has_tz = (dt.tzinfo is not None)
 if (show_tzinfo and has_tz):
  ret = ''.join(dt.isoformat().rsplit(':', 1))
 elif (show_tzinfo and (not has_tz)):
  ret = ('%s+0000' % dt.isoformat().split('.')[0])
 elif ((not show_tzinfo) and has_tz):
  ret = dt.isoformat()[:(-6)]
 elif ((not show_tzinfo) and (not has_tz)):
  ret = dt.isoformat().split('.')[0]
 return ret

def iso_time_string ( val , show_tzinfo = False ) : if ( not val ) : return '' if isinstance ( val , six . string_types ) : dt = _parse_datetime_string ( val ) else : dt = val if ( not isinstance ( dt , datetime . datetime ) ) : dt = datetime . datetime . fromordinal ( dt . toordinal ( ) ) has_tz = ( dt . tzinfo is not None ) if ( show_tzinfo and has_tz ) : ret = '' . join ( dt . isoformat ( ) . rsplit ( ':' , 1 ) ) elif ( show_tzinfo and ( not has_tz ) ) : ret = ( '%s+0000' % dt . isoformat ( ) . split ( '.' ) [ 0 ] ) elif ( ( not show_tzinfo ) and has_tz ) : ret = dt . isoformat ( ) [ : ( - 6 ) ] elif ( ( not show_tzinfo ) and ( not has_tz ) ) : ret = dt . isoformat ( ) . split ( '.' ) [ 0 ] return ret
takes either a date .