def METHOD_NAME(self, key, index=None):
    if index is not None and index not in self._indexes:
        raise ValueError('Index {} does not exist'.format(index))
    if index:
        return key.encode() in self._indexes[index][0]
    return key in self._data