code: def check_deprecation(func, match=None):
      """Check if a function raises a deprecation warning."""
  
      @functools.wraps(func)
      def wrapped(*args, **kwargs):
          with pytest.warns(DeprecationWarning, match=match):
              result = func(*args, **kwargs)
          return result
  
      return wrapped
  
file_path: nilearn/nilearn/_utils/testing.py
imports: import functools
  import gc
  import os
  import sys
  import tempfile
  import warnings
  from pathlib import Path
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: check_deprecation(func, match) and returns: wrapped, result