#NEWLINE# def isotime( at = None , subsecond = False ) : #NEWLINE# #INDENT# 'Stringify time in ISO 8601 format.' #NEWLINE# if ( not at ) : #NEWLINE# #INDENT# at = utcnow ( ) #NEWLINE# #UNINDENT# st = at . strftime ( ( _ISO8601_TIME_FORMAT if ( not subsecond ) else _ISO8601_TIME_FORMAT_SUBSECOND ) ) #NEWLINE# tz = ( at . tzinfo . tzname ( None ) if subsecond . tzinfo else 'UTC' ) #NEWLINE# st += ( 'Z' if ( tz == 'UTC' ) else tz ) #NEWLINE# return st