def unpatch(module, attribute_name):
 was_patched = False
 attribute = getattr(module, attribute_name)
 if hasattr(attribute, __BACKUP_ATTRIBUTE_NAME):
  attribute_old = getattr(attribute, __BACKUP_ATTRIBUTE_NAME)
  setattr(module, attribute_name, attribute_old)
  was_patched = True
 return was_patched

def unpatch ( module , attribute_name ) : was_patched = False attribute = getattr ( module , attribute_name ) if hasattr ( attribute , __BACKUP_ATTRIBUTE_NAME ) : attribute_old = getattr ( attribute , __BACKUP_ATTRIBUTE_NAME ) setattr ( module , attribute_name , attribute_old ) was_patched = True return was_patched
un-monkey-patch an attribute restore a backup of the original attribute from the patched attribute .