code: def mock_register_at_fork(func):
      # bpo-30599: Mock os.register_at_fork() when importing the random module,
      # since this function doesn't allow to unregister callbacks and would leak
      # memory.
      from unittest import mock
  
      return mock.patch("os.register_at_fork", create=True)(func)
  
imports: import contextlib
  import _imp
  import importlib
  import importlib.util
  import os
  import shutil
  import sys
  import unittest
  import warnings
  from .os_helper import unlink, temp_dir
label_desc: Use image node_id 12 for calling a global function with example usage: mock_register_at_fork(func) and returns: mock