def format_timestamp(ts):
 if isinstance(ts, numbers.Real):
  pass
 elif isinstance(ts, (tuple, time.struct_time)):
  ts = calendar.timegm(ts)
 elif isinstance(ts, datetime.datetime):
  ts = calendar.timegm(ts.utctimetuple())
 else:
  raise TypeError(('unknown timestamp type: %r' % ts))
 return email.utils.formatdate(ts, usegmt=True)

def format_timestamp ( ts ) : if isinstance ( ts , numbers . Real ) : pass elif isinstance ( ts , ( tuple , time . struct_time ) ) : ts = calendar . timegm ( ts ) elif isinstance ( ts , datetime . datetime ) : ts = calendar . timegm ( ts . utctimetuple ( ) ) else : raise TypeError ( ( 'unknown timestamp type: %r' % ts ) ) return email . utils . formatdate ( ts , usegmt = True )
formats a timestamp in the format used by http .