nodes: 0, module; 1, function_definition; 2, function_name:get_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:terms; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, try_statement; 14, if_statement; 15, return_statement; 16, identifier:limit; 17, integer:0; 18, identifier:sort; 19, False; 20, identifier:ranks; 21, None; 22, comment:"""
          Get the specified cards from the stack.
  
          :arg term:
              The search term. Can be a card full name, value, suit,
              abbreviation, or stack indice.
          :arg int limit:
              The number of items to retrieve for each term.
          :arg bool sort:
              Whether or not to sort the results, by poker ranks.
          :arg dict ranks:
              The rank dict to reference for sorting. If ``None``, it will
              default to ``DEFAULT_RANKS``.
  
          :returns:
              A list of the specified cards, if found.
  
          """; 23, assignment; 24, assignment; 25, block; 26, except_clause; 27, identifier:sort; 28, block; 29, identifier:got_cards; 30, identifier:ranks; 31, boolean_operator; 32, identifier:got_cards; 33, list; 34, expression_statement; 35, expression_statement; 36, expression_statement; 37, block; 38, expression_statement; 39, identifier:ranks; 40, attribute; 41, assignment; 42, assignment; 43, assignment; 44, expression_statement; 45, for_statement; 46, expression_statement; 47, assignment; 48, identifier:self; 49, identifier:ranks; 50, identifier:indices; 51, call; 52, identifier:got_cards; 53, list_comprehension; 54, attribute; 55, list_comprehension; 56, assignment; 57, identifier:item; 58, identifier:terms; 59, block; 60, assignment; 61, identifier:got_cards; 62, call; 63, attribute; 64, argument_list; 65, subscript; 66, for_in_clause; 67, if_clause; 68, identifier:self; 69, identifier:cards; 70, identifier:v; 71, for_in_clause; 72, if_clause; 73, identifier:indices; 74, list; 75, try_statement; 76, attribute; 77, list_comprehension; 78, identifier:sort_cards; 79, argument_list; 80, identifier:self; 81, identifier:find_list; 82, identifier:terms; 83, keyword_argument; 84, attribute; 85, identifier:i; 86, identifier:i; 87, identifier:indices; 88, comparison_operator:self.cards[i]
                  not in got_cards; 89, pattern_list; 90, call; 91, comparison_operator:i not in indices; 92, block; 93, except_clause; 94, identifier:self; 95, identifier:cards; 96, identifier:v; 97, for_in_clause; 98, if_clause; 99, identifier:got_cards; 100, identifier:ranks; 101, identifier:limit; 102, identifier:limit; 103, identifier:self; 104, identifier:cards; 105, subscript; 106, identifier:got_cards; 107, identifier:i; 108, identifier:v; 109, identifier:enumerate; 110, argument_list; 111, identifier:i; 112, identifier:indices; 113, expression_statement; 114, if_statement; 115, block; 116, pattern_list; 117, call; 118, comparison_operator:i not in indices; 119, attribute; 120, identifier:i; 121, attribute; 122, assignment; 123, comparison_operator:card not in got_cards; 124, block; 125, expression_statement; 126, expression_statement; 127, identifier:i; 128, identifier:v; 129, identifier:enumerate; 130, argument_list; 131, identifier:i; 132, identifier:indices; 133, identifier:self; 134, identifier:cards; 135, identifier:self; 136, identifier:cards; 137, identifier:card; 138, subscript; 139, identifier:card; 140, identifier:got_cards; 141, expression_statement; 142, expression_statement; 143, augmented_assignment; 144, augmented_assignment; 145, attribute; 146, attribute; 147, identifier:item; 148, call; 149, call; 150, identifier:indices; 151, call; 152, identifier:got_cards; 153, list_comprehension; 154, identifier:self; 155, identifier:cards; 156, identifier:self; 157, identifier:cards; 158, attribute; 159, argument_list; 160, attribute; 161, argument_list; 162, attribute; 163, argument_list; 164, subscript; 165, for_in_clause; 166, if_clause; 167, identifier:got_cards; 168, identifier:append; 169, identifier:card; 170, identifier:indices; 171, identifier:append; 172, identifier:item; 173, identifier:self; 174, identifier:find; 175, identifier:item; 176, keyword_argument; 177, attribute; 178, identifier:i; 179, identifier:i; 180, identifier:indices; 181, comparison_operator:self.cards[i] not in got_cards; 182, identifier:limit; 183, identifier:limit; 184, identifier:self; 185, identifier:cards; 186, subscript; 187, identifier:got_cards; 188, attribute; 189, identifier:i; 190, identifier:self; 191, identifier:cards
code: def get_list(self, terms, limit=0, sort=False, ranks=None):
          """
          Get the specified cards from the stack.
  
          :arg term:
              The search term. Can be a card full name, value, suit,
              abbreviation, or stack indice.
          :arg int limit:
              The number of items to retrieve for each term.
          :arg bool sort:
              Whether or not to sort the results, by poker ranks.
          :arg dict ranks:
              The rank dict to reference for sorting. If ``None``, it will
              default to ``DEFAULT_RANKS``.
  
          :returns:
              A list of the specified cards, if found.
  
          """
          ranks = ranks or self.ranks
          got_cards = []
  
          try:
              indices = self.find_list(terms, limit=limit)
              got_cards = [self.cards[i] for i in indices if self.cards[i]
                  not in got_cards]
              self.cards = [v for i, v in enumerate(self.cards) if
                  i not in indices]
          except:
              indices = []
              for item in terms:
                  try:
                      card = self.cards[item]
                      if card not in got_cards:
                          got_cards.append(card)
                          indices.append(item)
                  except:
                      indices += self.find(item, limit=limit)
                      got_cards += [self.cards[i] for i in indices if
                          self.cards[i] not in got_cards]
              self.cards = [v for i, v in enumerate(self.cards) if
                  i not in indices]
  
          if sort:
              got_cards = sort_cards(got_cards, ranks)
  
          return got_cards