nodes: 0, module; 1, function_definition; 2, function_name:find_all_by_mapreduce_state; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:mapreduce_state; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, comment:"""Find all shard states for given mapreduce.
  
      Args:
        mapreduce_state: MapreduceState instance
  
      Yields:
        shard states sorted by shard id.
      """; 12, assignment; 13, assignment; 14, comparison_operator:i < len(keys); 15, block; 16, identifier:keys; 17, call; 18, identifier:i; 19, integer:0; 20, identifier:i; 21, call; 22, decorated_definition; 23, comment:# We need a separate function to so that we can mix non-transactional and; 24, comment:# use be a generator; 25, expression_statement; 26, for_statement; 27, attribute; 28, argument_list; 29, identifier:len; 30, argument_list; 31, decorator; 32, function_definition; 33, assignment; 34, identifier:s; 35, identifier:states; 36, block; 37, identifier:cls; 38, identifier:calculate_keys_by_mapreduce_state; 39, identifier:mapreduce_state; 40, identifier:keys; 41, attribute; 42, function_name:no_tx_get; 43, parameters; 44, block; 45, identifier:states; 46, call; 47, expression_statement; 48, if_statement; 49, identifier:db; 50, identifier:non_transactional; 51, identifier:i; 52, return_statement; 53, identifier:no_tx_get; 54, argument_list; 55, augmented_assignment; 56, comparison_operator:s is not None; 57, block; 58, call; 59, identifier:i; 60, identifier:i; 61, integer:1; 62, identifier:s; 63, None; 64, expression_statement; 65, attribute; 66, argument_list; 67, yield; 68, identifier:db; 69, identifier:get; 70, subscript; 71, identifier:s; 72, identifier:keys; 73, slice; 74, identifier:i; 75, binary_operator:i+cls._MAX_STATES_IN_MEMORY; 76, identifier:i; 77, attribute; 78, identifier:cls; 79, identifier:_MAX_STATES_IN_MEMORY
code: def find_all_by_mapreduce_state(cls, mapreduce_state):
      """Find all shard states for given mapreduce.
  
      Args:
        mapreduce_state: MapreduceState instance
  
      Yields:
        shard states sorted by shard id.
      """
      keys = cls.calculate_keys_by_mapreduce_state(mapreduce_state)
      i = 0
      while i < len(keys):
        @db.non_transactional
        def no_tx_get(i):
          return db.get(keys[i:i+cls._MAX_STATES_IN_MEMORY])
        # We need a separate function to so that we can mix non-transactional and
        # use be a generator
        states = no_tx_get(i)
        for s in states:
          i += 1
          if s is not None:
            yield s