def get_mentions(self, docs=None, sort=False):
result = []<EOL>if docs:<EOL><INDENT>docs = docs if isinstance(docs, (list, tuple)) else [docs]<EOL>for mention_class in self.mention_classes:<EOL><INDENT>mentions = (<EOL>self.session.query(mention_class)<EOL>.filter(mention_class.document_id.in_([doc.id for doc in docs]))<EOL>.order_by(mention_class.id)<EOL>.all()<EOL>)<EOL>if sort:<EOL><INDENT>mentions = sorted(mentions, key=lambda x: x[<NUM_LIT:0>].get_stable_id())<EOL><DEDENT>result.append(mentions)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for mention_class in self.mention_classes:<EOL><INDENT>mentions = (<EOL>self.session.query(mention_class).order_by(mention_class.id).all()<EOL>)<EOL>if sort:<EOL><INDENT>mentions = sorted(mentions, key=lambda x: x[<NUM_LIT:0>].get_stable_id())<EOL><DEDENT>result.append(mentions)<EOL><DEDENT><DEDENT>return result<EOL>
Return a list of lists of the mentions associated with this extractor.

        Each list of the return will contain the Mentions for one of the
        mention classes associated with the MentionExtractor.

        :param docs: If provided, return Mentions from these documents. Else,
            return all Mentions.
        :param sort: If sort is True, then return all Mentions sorted by stable_id.
        :type sort: bool
        :return: Mentions for each mention_class.
        :rtype: List of lists.