# 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)


class ListsCommandMixin:

    RESPONSE_CALLBACKS = dict_merge(
        string_keys_to_dict(
            'BLPOP BRPOP',
            lambda r: r and tuple(r) or None
        ),

# 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)



class ListsCommandMixin:

    RESPONSE_CALLBACKS = dict_merge(
        string_keys_to_dict(
            'BLPOP BRPOP',
            lambda r: r and tuple(r) or None
        ),

        string_keys_to_dict(