nodes: 0, module; 1, function_definition; 2, function_name:_sorted_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys; 7, identifier:startkey; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, for_statement; 16, identifier:reverse; 17, False; 18, comment:"""Generator that yields sorted keys starting with startkey
  
          Parameters
          ----------
  
          keys: Iterable of tuple/list
          \tKey sequence that is sorted
          startkey: Tuple/list
          \tFirst key to be yielded
          reverse: Bool
          \tSort direction reversed if True
  
          """; 19, assignment; 20, identifier:reverse; 21, block; 22, else_clause; 23, assignment; 24, assignment; 25, assignment; 26, identifier:key; 27, identifier:searchkeys; 28, block; 29, identifier:tuple_key; 30, lambda; 31, expression_statement; 32, block; 33, identifier:searchkeys; 34, call; 35, identifier:searchpos; 36, call; 37, identifier:searchkeys; 38, binary_operator:searchkeys[searchpos:] + searchkeys[:searchpos]; 39, expression_statement; 40, lambda_parameters; 41, subscript; 42, assignment; 43, expression_statement; 44, identifier:sorted; 45, argument_list; 46, identifier:sum; 47, generator_expression; 48, subscript; 49, subscript; 50, yield; 51, identifier:t; 52, identifier:t; 53, slice; 54, identifier:tuple_cmp; 55, lambda; 56, assignment; 57, identifier:keys; 58, keyword_argument; 59, keyword_argument; 60, integer:1; 61, for_in_clause; 62, identifier:searchkeys; 63, slice; 64, identifier:searchkeys; 65, slice; 66, identifier:key; 67, unary_operator; 68, lambda_parameters; 69, comparison_operator:t[::-1] > startkey[::-1]; 70, identifier:tuple_cmp; 71, lambda; 72, identifier:key; 73, identifier:tuple_key; 74, identifier:reverse; 75, identifier:reverse; 76, identifier:_; 77, call; 78, identifier:searchpos; 79, identifier:searchpos; 80, integer:1; 81, identifier:t; 82, subscript; 83, subscript; 84, lambda_parameters; 85, comparison_operator:t[::-1] < startkey[::-1]; 86, identifier:ifilter; 87, argument_list; 88, identifier:t; 89, slice; 90, identifier:startkey; 91, slice; 92, identifier:t; 93, subscript; 94, subscript; 95, identifier:tuple_cmp; 96, identifier:searchkeys; 97, unary_operator; 98, unary_operator; 99, identifier:t; 100, slice; 101, identifier:startkey; 102, slice; 103, integer:1; 104, integer:1; 105, unary_operator; 106, unary_operator; 107, integer:1; 108, integer:1
code: def _sorted_keys(self, keys, startkey, reverse=False):
          """Generator that yields sorted keys starting with startkey
  
          Parameters
          ----------
  
          keys: Iterable of tuple/list
          \tKey sequence that is sorted
          startkey: Tuple/list
          \tFirst key to be yielded
          reverse: Bool
          \tSort direction reversed if True
  
          """
  
          tuple_key = lambda t: t[::-1]
          if reverse:
              tuple_cmp = lambda t: t[::-1] > startkey[::-1]
          else:
              tuple_cmp = lambda t: t[::-1] < startkey[::-1]
  
          searchkeys = sorted(keys, key=tuple_key, reverse=reverse)
          searchpos = sum(1 for _ in ifilter(tuple_cmp, searchkeys))
  
          searchkeys = searchkeys[searchpos:] + searchkeys[:searchpos]
  
          for key in searchkeys:
              yield key