code: def writeCleanup(self, varBind, **context):
          
          name, val = varBind
  
          (debug.logger & debug.FLAG_INS and
           debug.logger('%s: writeCleanup(%s, %r)' % (self, name, val)))
  
          cbFun = context['cbFun']
  
          self.branchVersionId += 1
  
          instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
          idx = context['idx']
  
          if idx in instances[self.ST_CREATE]:
              self.createCleanup(varBind, **context)
              return
  
          if idx in instances[self.ST_DESTROY]:
              self.destroyCleanup(varBind, **context)
              return
  
          try:
              node = self.getBranch(name, **context)
  
          except (error.NoSuchInstanceError, error.NoSuchObjectError) as exc:
              cbFun(varBind, **dict(context, error=exc))
  
          else:
              node.writeCleanup(varBind, **context)
docs: Finalize Managed Object Instance modification.
  
          Implements the successful third step of the multi-step workflow of the
          SNMP SET command processing (:RFC:`1905#section-4.2.5`).
  
          The goal of the third (successful) phase is to seal the new state of the
          requested Managed Object Instance. Once the system transition into the
          *cleanup* state, no roll back to the previous Managed Object Instance
          state is possible.
  
          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 set
  
          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.
  
          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.