docs: def undo(self, editor):
          """Create a new Action that undos the effects of this one, or,
          more accurately, reverts the object of this Action to the state
          at which it was right before the Action took place."""
          inst = self.timemachine
          if not self.is_revertible:
              raise DisciplineException("You tried to undo a non-revertible action! "
                                 "Check action.is_revertible and action.undo_errors"
                                 " before trying to undo.")
  
          if self.action_type == "dl":
              obj = inst.restore()
              self.reverted = save_object(obj, editor)
              self.save()
          elif self.action_type == "md":
              # Restore as it was *before* the modification
              obj = inst.at_previous_action.restore()
              self.reverted = save_object(obj, editor)
              self.save()
          else:
              editor.delete_object(inst.get_object())
              # This is safe from race conditions but still a pretty inelegant
              # solution. I can't figure out a different way to find the last action
              # for now
              self.reverted = DeletionCommit.objects.filter(
                  object_uid = self.object_uid
              ).order_by("-action__id")[0].action
              self.save()