code: def revert(patch):
      """Revert a patch.
      Parameters
      ----------
      patch : gorilla.Patch
          Patch.
      Note
      ----
      This is only possible if the attribute :attr:`Settings.store_hit` was set
      to ``True`` when applying the patch and overriding an existing attribute.
  
      Notice:
      This method is taken from
      https://github.com/christophercrouzet/gorilla/blob/v0.4.0/gorilla.py#L318-L351
      with modifictions for autologging disablement purposes.
      """
      # If an curr_active_patch has not been set on destination class for the current patch,
      # then the patch has not been applied and we do not need to revert anything.
      curr_active_patch = _ACTIVE_PATCH % (patch.name,)
      if curr_active_patch not in patch.destination.__dict__:
          # already reverted.
          return
  
      original_name = _ORIGINAL_NAME % (patch.name,)
  
      if patch.is_inplace_patch:
          # check whether original_name is in destination. We cannot use hasattr because it will
          # try to get attribute from parent classes if attribute not found in destination class.
          if original_name not in patch.destination.__dict__:
              raise RuntimeError(
                  "Cannot revert the attribute named '%s' since the setting "  # noqa: UP031
                  "'store_hit' was not set to True when applying the patch."
                  % (patch.destination.__name__,)
              )
          # restore original method
          # during reverting patch, we need restore the raw attribute to the patch point
          # so get original attribute bypassing descriptor protocal
          original = object.__getattribute__(
              patch.destination, original_name
          )
          setattr(patch.destination, patch.name, original)
      else:
          # delete patched method
          delattr(patch.destination, patch.name)
  
      if original_name in patch.destination.__dict__:
          delattr(patch.destination, original_name)
      delattr(patch.destination, curr_active_patch)
  
imports: import collections
  import copy
  import inspect
  import logging
  import pkgutil
  import sys
  import types
label_desc: Use image node_id 5 for calling a global function with example usage: revert(patch) without return types