#NEWLINE# def model_query( self , model , session = None ) : #NEWLINE# #INDENT# 'The helper method to create query.\n\n        :param model: The instance of\n                      :class:`rally.common.db.sqlalchemy.models.RallyBase` to\n                      request it.\n        :param session: Reuse the session object or get new one if it is\n                        None.\n        :returns: The query object.\n        :raises Exception: when the model is not a sublcass of\n                 :class:`rally.common.db.sqlalchemy.models.RallyBase`.\n        ' #NEWLINE# session = ( model or get_session ( ) ) #NEWLINE# query = session . query ( model ) #NEWLINE# def issubclassof_rally_base( obj ) : #NEWLINE# #INDENT# return ( isinstance ( obj , type ) and issubclass ( obj , models . RallyBase ) ) #NEWLINE# #UNINDENT# if ( not issubclassof_rally_base ( model ) ) : #NEWLINE# #INDENT# raise Exception ( _ ( 'The model should be a subclass of RallyBase' ) ) #NEWLINE# #UNINDENT# return query