def prepend_timestamp(msg, format):
 if (type(format) is str):
  timestamp = time.strftime(format, time.localtime())
 elif callable(format):
  timestamp = str(format())
 else:
  raise InvalidTimestampFormat
 return ('%s DCTB %s' % (timestamp, msg))

def prepend_timestamp ( msg , format ) : if ( type ( format ) is str ) : timestamp = time . strftime ( format , time . localtime ( ) ) elif callable ( format ) : timestamp = str ( format ( ) ) else : raise InvalidTimestampFormat return ( '%s DCTB %s' % ( timestamp , msg ) )
prepend timestamp to a message in a standard way .