Destroy Managed Object Instance.

        Implements the second of the multi-step workflow similar to the SNMP SET
        command processing (:RFC:`1905#section-4.2.5`).

        The goal of the second phase is to actually remove requested Managed
        Object Instance from the MIB tree. When multiple Managed Objects Instances
        are destroyed/modified at once (likely coming all in one SNMP PDU), each
        of them has to run through the second (*commit*) phase successfully for
        the system to transition to the third (*cleanup*) phase. If any single
        *commit* step fails, the system transitions into the *undo* state for
        each of Managed Objects Instances being processed at once.

        The role of this object in the MIB tree is non-terminal. It does not
        access the actual Managed Object Instance, but just traverses one level
        down the MIB tree and hands off the query to the underlying objects.

        Parameters
        ----------
        varBind: :py:class:`~pysnmp.smi.rfc1902.ObjectType` object representing
            new Managed Object Instance value to destroy

        Other Parameters
        ----------------
        \*\*context:

            Query parameters:

            * `cbFun` (callable) - user-supplied callable that is invoked to
              pass the new value of the Managed Object Instance or an error.

            * `instances` (dict): user-supplied dict for temporarily holding
              Managed Objects Instances being destroyed.

        Notes
        -----
        The callback functions (e.g. `cbFun`) have the same signature as this
        method where `varBind` contains the new Managed Object Instance value.

        In case of an error, the `error` key in the `context` dict will contain
        an exception object.

def destroyCommit(self, varBind, **context):
        """Destroy Managed Object Instance.

        Implements the second of the multi-step workflow similar to the SNMP SET
        command processing (:RFC:`1905#section-4.2.5`).

        The goal of the second phase is to actually remove requested Managed
        Object Instance from the MIB tree. When multiple Managed Objects Instances
        are destroyed/modified at once (likely coming all in one SNMP PDU), each
        of them has to run through the second (*commit*) phase successfully for
        the system to transition to the third (*cleanup*) phase. If any single
        *commit* step fails, the system transitions into the *undo* state for
        each of Managed Objects Instances being processed at once.

        The role of this object in the MIB tree is non-terminal. It does not
        access the actual Managed Object Instance, but just traverses one level
        down the MIB tree and hands off the query to the underlying objects.

        Parameters
        ----------
        varBind: :py:class:`~pysnmp.smi.rfc1902.ObjectType` object representing
            new Managed Object Instance value to destroy

        Other Parameters
        ----------------
        \*\*context:

            Query parameters:

            * `cbFun` (callable) - user-supplied callable that is invoked to
              pass the new value of the Managed Object Instance or an error.

            * `instances` (dict): user-supplied dict for temporarily holding
              Managed Objects Instances being destroyed.

        Notes
        -----
        The callback functions (e.g. `cbFun`) have the same signature as this
        method where `varBind` contains the new Managed Object Instance value.

        In case of an error, the `error` key in the `context` dict will contain
        an exception object.
        """
        name, val = varBind

        (debug.logger & debug.FLAG_INS and
         debug.logger('%s: destroyCommit(%s, %r)' % (self, name, val)))

        instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
        idx = context['idx']

        # NOTE: multiple names are possible in a single PDU, that could collide
        # Therefore let's keep old object indexed by (negative) var-bind index
        try:
            instances[self.ST_DESTROY][-idx - 1] = self._vars.pop(name)

        except KeyError:
            pass

        cbFun = context['cbFun']
        cbFun(varBind, **context)