code: def _copy_func(
      f,
      name=None,
  ):
      """Copy function.
  
      Return a function with same code, globals, defaults, closure, and
      name (or provide a new name).
  
      Additionally, keyword arguments are transformed into positional arguments for
      compatibility with pytest.
      """
      fn = types.FunctionType(
          f.__code__,
          f.__globals__,
          name or f.__name__,
          f.__defaults__,
          f.__closure__,
      )
      fn.__dict__.update(f.__dict__)
  
      sign = inspect.signature(fn)
      defaults, new_params = {}, []
      for param in sign.parameters.values():
          if param.default is inspect._empty:
              new_params.append(param)
          else:
              new_params.append(inspect.Parameter(param.name, kind=1))
              defaults[param.name] = param.default
      new_sign = sign.replace(parameters=new_params)
      fn.__signature__ = new_sign
  
      return fn, defaults
  
imports: import functools
  import importlib
  import inspect
  import json
  import os
  import subprocess
  import tempfile
  import types
  import warnings
  import pytest
  from matplotlib import pyplot
  import geomstats.backend
  from geomstats.exceptions import AutodiffNotImplementedError
  from geomstats.test.test_case import autodiff_backend
  from geomstats.test.vectorization import test_vectorization
label_desc: Use image node_id 11 for calling a global function with example usage: _copy_func(f, name) and returns: fn,  defaults