def utcstr(ts=None):
 assert ((ts is None) or isinstance(ts, datetime))
 if (ts is None):
  ts = datetime.utcnow()
 return u'{0}Z'.format(ts.strftime(u'%Y-%m-%dT%H:%M:%S.%f')[:(-3)])

def utcstr ( ts = None ) : assert ( ( ts is None ) or isinstance ( ts , datetime ) ) if ( ts is None ) : ts = datetime . utcnow ( ) return u'{0}Z' . format ( ts . strftime ( u'%Y-%m-%dT%H:%M:%S.%f' ) [ : ( - 3 ) ] )
format utc timestamp in iso 8601 format .