def timestamp_parameter(timestamp, allow_none=True):
 if (timestamp is None):
  if allow_none:
   return None
  raise ValueError('Timestamp value cannot be None')
 if isinstance(timestamp, datetime.datetime):
  return (timestamp.isoformat() + 'Z')
 if isinstance(timestamp, compat.basestring):
  if (not ISO_8601.match(timestamp)):
   raise ValueError(('Invalid timestamp: %s is not a valid ISO-8601 formatted date' % timestamp))
  return timestamp
 raise ValueError(('Cannot accept type %s for timestamp' % type(timestamp)))

def timestamp_parameter ( timestamp , allow_none = True ) : if ( timestamp is None ) : if allow_none : return None raise ValueError ( 'Timestamp value cannot be None' ) if isinstance ( timestamp , datetime . datetime ) : return ( timestamp . isoformat ( ) + 'Z' ) if isinstance ( timestamp , compat . basestring ) : if ( not ISO_8601 . match ( timestamp ) ) : raise ValueError ( ( 'Invalid timestamp: %s is not a valid ISO-8601 formatted date' % timestamp ) ) return timestamp raise ValueError ( ( 'Cannot accept type %s for timestamp' % type ( timestamp ) ) )
function to check the conformance of timestamps passed by users .