# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# def dict_merge(*dicts):
#     merged = {}
#     for d in dicts:
#         merged.update(d)
#     return merged
# 
# def bool_ok(response):
#     return nativestr(response) == 'OK'
# 
# def nativestr(x):
#     return x if isinstance(x, str) else x.decode('utf-8', 'replace')
# 
# def string_keys_to_dict(key_string, callback):
#     return dict.fromkeys(key_string.split(), callback)
# 
# Path: aredis/exceptions.py
# class DataError(RedisError):
#     pass
# 
# class RedisClusterException(Exception):
#     pass
# 
# class RedisError(Exception):
#     pass


from aredis.utils import (b, dict_merge,
                          bool_ok, nativestr,
                          string_keys_to_dict)
from aredis.exceptions import (DataError,
                               RedisClusterException,
                               RedisError)
            are for paging through the sorted data

        :by:
            allows using an external key to weight and sort the items.
            Use an "*" to indicate where in the key the item value is located

        :get:
            is for returning items from external keys rather than the
            sorted data itself.  Use an "*" to indicate where int he key
            the item value is located

        :desc:
            is for reversing the sort

        :alpha:
            is for sorting lexicographically rather than numerically

        :store:
            is for storing the result of the sort into the key `store`

        ClusterImpl:
            A full implementation of the server side sort mechanics because many of the
            options work on multiple keys that can exist on multiple servers.
        """
        if (start is None and num is not None) or \
                (start is not None and num is None):
            raise RedisError("RedisError: ``start`` and ``num`` must both be specified")
        try:
            data_type = b(await self.type(name))


# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# def dict_merge(*dicts):
#     merged = {}
#     for d in dicts:
#         merged.update(d)
#     return merged
# 
# def bool_ok(response):
#     return nativestr(response) == 'OK'
# 
# def nativestr(x):
#     return x if isinstance(x, str) else x.decode('utf-8', 'replace')
# 
# def string_keys_to_dict(key_string, callback):
#     return dict.fromkeys(key_string.split(), callback)
# 
# Path: aredis/exceptions.py
# class DataError(RedisError):
#     pass
# 
# class RedisClusterException(Exception):
#     pass
# 
# class RedisError(Exception):
#     pass


# Path: aredis/commands/lists.py
from aredis.utils import (b, dict_merge,
                          bool_ok, nativestr,
                          string_keys_to_dict)
from aredis.exceptions import (DataError,
                               RedisClusterException,
                               RedisError)

            are for paging through the sorted data

        :by:
            allows using an external key to weight and sort the items.
            Use an "*" to indicate where in the key the item value is located

        :get:
            is for returning items from external keys rather than the
            sorted data itself.  Use an "*" to indicate where int he key
            the item value is located

        :desc:
            is for reversing the sort

        :alpha:
            is for sorting lexicographically rather than numerically

        :store:
            is for storing the result of the sort into the key `store`

        ClusterImpl:
            A full implementation of the server side sort mechanics because many of the
            options work on multiple keys that can exist on multiple servers.
        """
        if (start is None and num is not None) or \
                (start is not None and num is None):
            raise RedisError("RedisError: ``start`` and ``num`` must both be specified")
        try:
            data_type = b(await self.type(name))


            if data_type == b("none"):