code: def _wrap_function(function_name: str, static: bool) -> Callable:
      """Wrap the function called `function_name`.
  
      Parameters
      ----------
      function_name
          the name of the function e.g. "abs", "mean" etc.
      static
          whether the function being wrapped will be added as a static method.
  
      Returns
      -------
      new_function
          the wrapped function.
      """
  
      def new_function(
          *args,
          key_chains: Optional[
              Union[Sequence[str], Dict[str, str], ivy.Container]
          ] = None,
          to_apply: Union[bool, ivy.Container] = True,
          prune_unapplied: Union[bool, ivy.Container] = False,
          map_sequences: Union[bool, ivy.Container] = False,
          out: Optional[ivy.Container] = None,
          **kwargs,
      ):
          function = ivy.__dict__[function_name]
          data_idx = function.array_spec[0]
          if (
              not (data_idx[0][0] == 0 and len(data_idx[0]) == 1)
              and args
              and ivy.is_ivy_container(args[0])
              and not static
          ):
              # if the method has been called as an instance method, and self should not
              # be the first positional arg, then we need to re-arrange and place self
              # in the correct location in the args or kwargs
              self = args[0]
              args = args[1:]
              if len(args) > data_idx[0][0]:
                  args = ivy.copy_nest(args, to_mutable=True)
                  data_idx = [data_idx[0][0]] + [
                      0 if idx is int else idx for idx in data_idx[1:]
                  ]
                  ivy.insert_into_nest_at_index(args, data_idx, self)
              else:
                  kwargs = ivy.copy_nest(kwargs, to_mutable=True)
                  data_idx = [data_idx[0][1]] + [
                      0 if idx is int else idx for idx in data_idx[1:]
                  ]
                  ivy.insert_into_nest_at_index(kwargs, data_idx, self)
  
          # return function multi-mapped across the corresponding leaves of the containers
          return ivy.ContainerBase.cont_multi_map_in_function(
              function_name,
              *args,
              key_chains=key_chains,
              to_apply=to_apply,
              prune_unapplied=prune_unapplied,
              map_sequences=map_sequences,
              out=out,
              **kwargs,
          )
  
      return new_function
  
imports: import ivy
  from typing import Callable, Type, List, Iterable, Optional, Union, Sequence, Dict
  from types import ModuleType
label_desc: Use image node_id 1 for calling a global function with example usage: _wrap_function(function_name, static) and returns: new_function, ivy