nodes: 0, module; 1, function_definition; 2, function_name:get_mentions; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:docs; 13, None; 14, identifier:sort; 15, False; 16, comment:"""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.
          """; 17, assignment; 18, identifier:docs; 19, block; 20, else_clause; 21, identifier:result; 22, identifier:result; 23, list; 24, expression_statement; 25, comment:# Get cands from all splits; 26, for_statement; 27, block; 28, assignment; 29, identifier:mention_class; 30, attribute; 31, block; 32, for_statement; 33, identifier:docs; 34, conditional_expression:docs if isinstance(docs, (list, tuple)) else [docs]; 35, identifier:self; 36, identifier:mention_classes; 37, expression_statement; 38, if_statement; 39, expression_statement; 40, identifier:mention_class; 41, attribute; 42, block; 43, identifier:docs; 44, call; 45, list; 46, assignment; 47, identifier:sort; 48, block; 49, call; 50, identifier:self; 51, identifier:mention_classes; 52, expression_statement; 53, if_statement; 54, expression_statement; 55, identifier:isinstance; 56, argument_list; 57, identifier:docs; 58, identifier:mentions; 59, parenthesized_expression; 60, expression_statement; 61, attribute; 62, argument_list; 63, assignment; 64, identifier:sort; 65, block; 66, call; 67, identifier:docs; 68, tuple; 69, call; 70, assignment; 71, identifier:result; 72, identifier:append; 73, identifier:mentions; 74, identifier:mentions; 75, parenthesized_expression; 76, expression_statement; 77, attribute; 78, argument_list; 79, identifier:list; 80, identifier:tuple; 81, attribute; 82, argument_list; 83, identifier:mentions; 84, call; 85, call; 86, assignment; 87, identifier:result; 88, identifier:append; 89, identifier:mentions; 90, call; 91, identifier:all; 92, identifier:sorted; 93, argument_list; 94, attribute; 95, argument_list; 96, identifier:mentions; 97, call; 98, attribute; 99, argument_list; 100, identifier:mentions; 101, keyword_argument; 102, call; 103, identifier:all; 104, identifier:sorted; 105, argument_list; 106, call; 107, identifier:order_by; 108, attribute; 109, identifier:key; 110, lambda; 111, attribute; 112, argument_list; 113, identifier:mentions; 114, keyword_argument; 115, attribute; 116, argument_list; 117, identifier:mention_class; 118, identifier:id; 119, lambda_parameters; 120, call; 121, call; 122, identifier:order_by; 123, attribute; 124, identifier:key; 125, lambda; 126, call; 127, identifier:filter; 128, call; 129, identifier:x; 130, attribute; 131, argument_list; 132, attribute; 133, argument_list; 134, identifier:mention_class; 135, identifier:id; 136, lambda_parameters; 137, call; 138, attribute; 139, argument_list; 140, attribute; 141, argument_list; 142, subscript; 143, identifier:get_stable_id; 144, attribute; 145, identifier:query; 146, identifier:mention_class; 147, identifier:x; 148, attribute; 149, argument_list; 150, attribute; 151, identifier:query; 152, identifier:mention_class; 153, attribute; 154, identifier:in_; 155, list_comprehension; 156, identifier:x; 157, integer:0; 158, identifier:self; 159, identifier:session; 160, subscript; 161, identifier:get_stable_id; 162, identifier:self; 163, identifier:session; 164, identifier:mention_class; 165, identifier:document_id; 166, attribute; 167, for_in_clause; 168, identifier:x; 169, integer:0; 170, identifier:doc; 171, identifier:id; 172, identifier:doc; 173, identifier:docs
code: def get_mentions(self, docs=None, sort=False):
          """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.
          """
          result = []
          if docs:
              docs = docs if isinstance(docs, (list, tuple)) else [docs]
              # Get cands from all splits
              for mention_class in self.mention_classes:
                  mentions = (
                      self.session.query(mention_class)
                      .filter(mention_class.document_id.in_([doc.id for doc in docs]))
                      .order_by(mention_class.id)
                      .all()
                  )
                  if sort:
                      mentions = sorted(mentions, key=lambda x: x[0].get_stable_id())
                  result.append(mentions)
          else:
              for mention_class in self.mention_classes:
                  mentions = (
                      self.session.query(mention_class).order_by(mention_class.id).all()
                  )
                  if sort:
                      mentions = sorted(mentions, key=lambda x: x[0].get_stable_id())
                  result.append(mentions)
          return result