code: def wrap_func(parser: ArgumentParser, func: Callable) -> Callable:
      @functools.wraps(func)
      def wrapper(args: Namespace) -> Any:
          args.func = func
          return func(parser.parse_args([], args))
  
      return wrapper
  
imports: import functools
  import itertools
  from argparse import SUPPRESS, ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
  from typing import Any, Callable, List, NamedTuple, Optional, Tuple, Union, cast
  from termcolor import colored
  from determined.common import util
label_desc: Use image node_id 4 for calling a global function with example usage: wrap_func(parser, func) and returns: wrapper, func