code: def register_parser_action(parse_func, kwargs):
      if "action" in kwargs:
          raise ValueError(
              "Cannot specify action if parser argument is provided to add_argument."
          )
  
      class ParserAction(argparse._StoreAction):
          def __init__(self, *args, **kwargs):
              if "parser" in kwargs:
                  del kwargs["parse_func"]
              super().__init__(*args, **kwargs)
  
          def __call__(
              self,
              parser,
              namespace,
              values,
              option_string=None,
          ):
              parsed = parse_func(values)
              setattr(namespace, self.dest, parsed)
  
      kwargs["action"] = ParserAction
  
file_path: snakemake/snakemake/common/argparse.py
imports: import argparse
  import configargparse
label_desc: Use image node_id 1 for calling a global function with example usage: register_parser_action(parse_func, kwargs) without return types