code: def pre_upgrade_checks(self, upgrades):
          errors = []
          for check in self.global_pre_upgrade:
              self._setup_log_prefix(plugin_id=check.__name__)
              try:
                  check()
              except RuntimeError as e:
                  errors.append((check.__name__, e.args))
          for u in upgrades:
              self._setup_log_prefix(plugin_id=u.name)
              try:
                  u.pre_upgrade()
              except RuntimeError as e:
                  errors.append((u.name, e.args))
          self._teardown_log_prefix()
          self._check_errors(errors, "Pre-upgrade check for %s failed with the"
                             " following errors:")