def _format_time(when):
 if (when is None):
  return None
 return datetime.isoformat(when)

def _format_time ( when ) : if ( when is None ) : return None return datetime . isoformat ( when )
format a time to iso8601 format .