code: def key_value(minion_id,
                pillar,
                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
      '''
      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 {}