def lock_and_delete_indexes(self, references, direction, entity_key):
    if direction == datastore_pb.Query_Order.ASCENDING:
      table_name = dbconstants.ASC_PROPERTY_TABLE
    else:
      table_name = dbconstants.DSC_PROPERTY_TABLE

    app = entity_key.split(self.ds_access._SEPARATOR)[0]
    try:
      txn_id = self.acquire_lock_for_key(
        app_id=app,
        key=entity_key,
        retries=self.ds_access.NON_TRANS_LOCK_RETRY_COUNT,
        retry_time=self.ds_access.LOCK_RETRY_TIME
      )
    except zk.ZKTransactionException:
      self.index_entries_delete_failures += 1
      return

    entities = self.fetch_entity_dict_for_references(references)

    refs_to_delete = []
    for reference in references:
      index_elements = reference.keys()[0].split(self.ds_access._SEPARATOR)
      prop_name = index_elements[self.ds_access.PROP_NAME_IN_SINGLE_PROP_INDEX]
      if not self.ds_access._DatastoreDistributed__valid_index_entry(
        reference, entities, direction, prop_name):
        refs_to_delete.append(reference.keys()[0])

    logging.debug('Removing {} indexes starting with {}'.
      format(len(refs_to_delete), [refs_to_delete[0]]))
    try:
      self.db_access.batch_delete(table_name, refs_to_delete,
        column_names=dbconstants.PROPERTY_SCHEMA)
      self.index_entries_cleaned += len(refs_to_delete)
    except Exception:
      logging.exception('Unable to delete indexes')
      self.index_entries_delete_failures += 1

    self.release_lock_for_key(
      app_id=app,
      key=entity_key,
      txn_id=txn_id,
      retries=self.ds_access.NON_TRANS_LOCK_RETRY_COUNT,
      retry_time=self.ds_access.LOCK_RETRY_TIME
    )
returns an instance with just those keys
dataset/ETHPy150Open AppScale/appscale/AppDB/groomer.py/DatastoreGroomer.lock_and_delete_indexes--crossover with--dataset/ETHPy150Open saltstack/salt/salt/modules/mount.py/_fstab_entry.pick