# Path: simplekv/_compat.py
# PY2 = sys.version_info[0] == 2


from ._compat import quote_plus, unquote_plus, text_type, binary_type
    :param store: The store to pass keys on to.
    :param prefix: Prefix to add.
    """

    def __init__(self, prefix, store):
        super(PrefixDecorator, self).__init__(store)
        self.prefix = prefix

    def _filter(self, key):
        return key.startswith(self.prefix)

    def _map_key(self, key):
        self._check_valid_key(key)
        return self.prefix + key

    def _map_key_prefix(self, key_prefix):
        return self.prefix + key_prefix

    def _unmap_key(self, key):
        assert key.startswith(self.prefix)

        return key[len(self.prefix):]


class URLEncodeKeysDecorator(KeyTransformingDecorator):
    """URL-encodes keys before passing them on to the underlying store."""
    def _map_key(self, key):
        if not isinstance(key, text_type):
            raise ValueError('%r is not a unicode string' % key)
        quoted = quote_plus(key.encode('utf-8'))

# Path: simplekv/_compat.py
# PY2 = sys.version_info[0] == 2


# Path: simplekv/decorator.py
from ._compat import quote_plus, unquote_plus, text_type, binary_type

    :param store: The store to pass keys on to.
    :param prefix: Prefix to add.
    """

    def __init__(self, prefix, store):
        super(PrefixDecorator, self).__init__(store)
        self.prefix = prefix

    def _filter(self, key):
        return key.startswith(self.prefix)

    def _map_key(self, key):
        self._check_valid_key(key)
        return self.prefix + key

    def _map_key_prefix(self, key_prefix):
        return self.prefix + key_prefix

    def _unmap_key(self, key):
        assert key.startswith(self.prefix)

        return key[len(self.prefix):]


class URLEncodeKeysDecorator(KeyTransformingDecorator):
    """URL-encodes keys before passing them on to the underlying store."""
    def _map_key(self, key):
        if not isinstance(key, text_type):
            raise ValueError('%r is not a unicode string' % key)
        quoted = quote_plus(key.encode('utf-8'))

        if isinstance(quoted, binary_type):