code: def _disable_user_warnings(
      func: Callable,
      regex: str = ".*is deprecated, please use.*",
      module: str = "torch",
  ) -> Callable:
      """
      Decorator that temporarily disables ``UserWarning``s for the given ``module`` if the warning message matches the
      given ``regex`` pattern.
  
      Arguments
      ---------
      func : function
          Function to disable the warnings for.
      regex : str
          A regex pattern compilable by ``re.compile``. This is used to match the ``UserWarning`` message.
      module : str
          The python module to which the filtering should be restricted.
  
      Returns
      -------
      function
          The wrapped function.
      """
  
      @wraps(func)
      def wrapper(*args, **kwargs):
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore",
                  category=UserWarning,
                  message=regex,
                  module=module,
              )
              return func(*args, **kwargs)
  
      return wrapper
  
imports: import __future__
  import collections
  import functools
  import types
  import warnings
  from typing import Dict, Set, List, Any, Callable, Iterable, Type, Tuple
  from functools import wraps
  import contextlib
  import torch
  from torch._C import _has_torch_function, _has_torch_function_unary, _has_torch_function_variadic, _add_docstr, _push_on_torch_function_stack, _pop_torch_function_stack, _get_function_stack_at, _len_torch_function_stack, _is_torch_function_mode_enabled
label_desc: Use image node_id 1 for calling a global function with example usage: _disable_user_warnings(func, regex, module) and returns: wrapper, func