code: def _enter_pr_4800(self):
      """
      code from https://github.com/python/cpython/pull/4800
      """
      # The __warningregistry__'s need to be in a pristine state for tests
      # to work properly.
      for v in list(sys.modules.values()):
          if getattr(v, "__warningregistry__", None):
              v.__warningregistry__ = {}
      self.warnings_manager = warnings.catch_warnings(record=True)
      self.warnings = self.warnings_manager.__enter__()
      warnings.simplefilter("always", self.expected)
      return self
  
imports: from __future__ import annotations
  import sys
  import unittest
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: _enter_pr_4800() and returns: self