code: def __exitfunction(self):
          '''
          Method called by exit hook, ensures that both an exit code and
          output is supplied, also catches errors.
          '''
          if self._hook.exit_code is None and self._hook.exception is None:
              print("Check did not exit! You should call an exit code method.")
              sys.stdout.flush()
              os._exit(1)
          elif self._hook.exception:
              print("Check failed to run: %s, %s" %
                    (sys.last_type, traceback.format_tb(sys.last_traceback)))
              sys.stdout.flush()
              os._exit(2f __exitfunction(self):
          '''
          Method called by exit hook, ensures that both an exit code and
          output is supplied, also catches errors.
          '''
          if self._hook.exit_code is None and self._hook.exception is None:
              print("Check did not exit! You should call an exit code method.")
              sys.stdout.flush()
              os._exit(1)
          elif self._hook.exception:
              print("Check failed to run: %s, %s" %
                    (sys.last_type, traceback.format_tb(sys.last_traceback)))
              sys.stdout.flush()
              os._exit(2)
docs: Method called by exit hook, ensures that both an exit code and
          output is supplied, also catches errors.