code: def _call_target(
      _target_: Callable[..., Any],
      _partial_: bool,
      args: Tuple[Any, ...],
      kwargs: Dict[str, Any],
      full_key: str,
  ) -> Any:
      """Call target (type) with args and kwargs."""
      try:
          args, kwargs = _extract_pos_args(args, kwargs)
          # detaching configs from parent.
          # At this time, everything is resolved and the parent link can cause
          # issues when serializing objects in some scenarios.
          for arg in args:
              if OmegaConf.is_config(arg):
                  arg._set_parent(None)
          for v in kwargs.values():
              if OmegaConf.is_config(v):
                  v._set_parent(None)
      except Exception as e:
          msg = (
              f"Error in collecting args and kwargs for '{_convert_target_to_string(_target_)}':"
              + f"\n{repr(e)}"
          )
          if full_key:
              msg += f"\nfull_key: {full_key}"
  
          raise InstantiationException(msg) from e
  
      if _partial_:
          try:
              return functools.partial(_target_, *args, **kwargs)
          except Exception as e:
              msg = (
                  f"Error in creating partial({_convert_target_to_string(_target_)}, ...) object:"
                  + f"\n{repr(e)}"
              )
              if full_key:
                  msg += f"\nfull_key: {full_key}"
              raise InstantiationException(msg) from e
      else:
          try:
              return _target_(*args, **kwargs)
          except Exception as e:
              msg = f"Error in call to target '{_convert_target_to_string(_target_)}':\n{repr(e)}"
              if full_key:
                  msg += f"\nfull_key: {full_key}"
              raise InstantiationException(msg) from e
  
imports: import copy
  import functools
  from enum import Enum
  from textwrap import dedent
  from typing import Any, Callable, Dict, List, Sequence, Tuple, Union
  from omegaconf import OmegaConf, SCMode
  from omegaconf._utils import is_structured_config
  from hydra._internal.utils import _locate
  from hydra.errors import InstantiationException
  from hydra.types import ConvertMode, TargetConf
label_desc: Use image node_id 3 for calling a global function with example usage: _call_target(_target_, _partial_, args, kwargs, full_key) and returns: functools, _target_