def keys(self, index=None):
        """Returns a list of keys in the database
        """
        if index is not None and index not in self._indexes:
            raise ValueError('Index {} does not exist'.format(index))

        db = self._indexes[index][0] if index else self._main_db
        with self._lmdb.begin(db=db) as txn:
            return [
                key.decode()
                for key in txn.cursor().iternext(keys=True, values=False)
            ]