nodes: 0, module; 1, function_definition; 2, function_name:key_value; 3, parameters; 4, block; 5, identifier:minion_id; 6, identifier:pillar; 7, comment:# pylint: disable=W0613; 8, default_parameter; 9, expression_statement; 10, comment:# Identify key type and process as needed based on that type; 11, expression_statement; 12, if_statement; 13, comment:# Return nothing for unhandled types; 14, return_statement; 15, identifier:pillar_key; 16, string; 17, string; 18, assignment; 19, comparison_operator:key_type == 'string'; 20, block; 21, elif_clause; 22, elif_clause; 23, elif_clause; 24, elif_clause; 25, dictionary; 26, string_content:redis_pillar; 27, string_content:Looks for key in redis matching minion_id, returns a structure based on the
      data type of the redis key. String for string type, dict for hash type and
      lists for lists, sets and sorted sets.
  
      pillar_key
          Pillar key to return data into; 28, identifier:key_type; 29, call; 30, identifier:key_type; 31, string; 32, return_statement; 33, comparison_operator:key_type == 'hash'; 34, block; 35, comparison_operator:key_type == 'list'; 36, block; 37, comparison_operator:key_type == 'set'; 38, block; 39, comparison_operator:key_type == 'zset'; 40, block; 41, subscript; 42, argument_list; 43, string_content:string; 44, dictionary; 45, identifier:key_type; 46, string; 47, return_statement; 48, identifier:key_type; 49, string; 50, expression_statement; 51, if_statement; 52, return_statement; 53, identifier:key_type; 54, string; 55, return_statement; 56, identifier:key_type; 57, string; 58, expression_statement; 59, if_statement; 60, return_statement; 61, identifier:__salt__; 62, string; 63, identifier:minion_id; 64, pair; 65, string_content:hash; 66, dictionary; 67, string_content:list; 68, assignment; 69, not_operator; 70, block; 71, dictionary; 72, string_content:set; 73, dictionary; 74, string_content:zset; 75, assignment; 76, not_operator; 77, block; 78, dictionary; 79, string_content:redis.key_type; 80, identifier:pillar_key; 81, call; 82, pair; 83, identifier:list_size; 84, call; 85, identifier:list_size; 86, return_statement; 87, pair; 88, pair; 89, identifier:set_size; 90, call; 91, identifier:set_size; 92, return_statement; 93, pair; 94, subscript; 95, argument_list; 96, identifier:pillar_key; 97, call; 98, subscript; 99, argument_list; 100, dictionary; 101, identifier:pillar_key; 102, call; 103, identifier:pillar_key; 104, call; 105, subscript; 106, argument_list; 107, dictionary; 108, identifier:pillar_key; 109, call; 110, identifier:__salt__; 111, string; 112, identifier:minion_id; 113, subscript; 114, argument_list; 115, identifier:__salt__; 116, string; 117, identifier:minion_id; 118, subscript; 119, argument_list; 120, subscript; 121, argument_list; 122, identifier:__salt__; 123, string; 124, identifier:minion_id; 125, subscript; 126, argument_list; 127, string_content:redis.get_key; 128, identifier:__salt__; 129, string; 130, identifier:minion_id; 131, string_content:redis.llen; 132, identifier:__salt__; 133, string; 134, identifier:minion_id; 135, integer:0; 136, binary_operator:list_size - 1; 137, identifier:__salt__; 138, string; 139, identifier:minion_id; 140, string_content:redis.zcard; 141, identifier:__salt__; 142, string; 143, identifier:minion_id; 144, integer:0; 145, binary_operator:set_size - 1; 146, string_content:redis.hgetall; 147, string_content:redis.lrange; 148, identifier:list_size; 149, integer:1; 150, string_content:redis.smembers; 151, string_content:redis.zrange; 152, identifier:set_size; 153, integer:1
code: def key_value(minion_id,
                pillar,  # pylint: disable=W0613
                pillar_key='redis_pillar'):
      '''
      Looks for key in redis matching minion_id, returns a structure based on the
      data type of the redis key. String for string type, dict for hash type and
      lists for lists, sets and sorted sets.
  
      pillar_key
          Pillar key to return data into
      '''
      # Identify key type and process as needed based on that type
      key_type = __salt__['redis.key_type'](minion_id)
      if key_type == 'string':
          return {pillar_key: __salt__['redis.get_key'](minion_id)}
      elif key_type == 'hash':
          return {pillar_key: __salt__['redis.hgetall'](minion_id)}
      elif key_type == 'list':
          list_size = __salt__['redis.llen'](minion_id)
          if not list_size:
              return {}
          return {pillar_key: __salt__['redis.lrange'](minion_id, 0,
                                                       list_size - 1)}
      elif key_type == 'set':
          return {pillar_key: __salt__['redis.smembers'](minion_id)}
      elif key_type == 'zset':
          set_size = __salt__['redis.zcard'](minion_id)
          if not set_size:
              return {}
          return {pillar_key: __salt__['redis.zrange'](minion_id, 0,
                                                       set_size - 1)}
      # Return nothing for unhandled types
      return {}