code: def map_parameters_in_fn_call(args, kwargs, func):
      """
      Based on function signature, parse args to to convert them to key-value
      pairs and merge them with kwargs
      Any parameter found in args that does not match the function signature
      is still passed.
      Missing parameters are filled with their default values
      """
      sig = signature(func)
      # Get missing parameters in kwargs to look for them in args
      args_spec = list(sig.parameters)
      params_all = set(args_spec)
      params_missing = params_all - set(kwargs.keys())
  
      if "self" in args_spec:
          offset = 1
      else:
          offset = 0
  
      # Get indexes for those args
      idxs = [args_spec.index(name) for name in params_missing]
  
      # Parse args
      args_parsed = dict()
  
      for idx in idxs:
          key = args_spec[idx]
  
          try:
              value = args[idx - offset]
          except IndexError:
              pass
          else:
              args_parsed[key] = value
  
      parsed = copy(kwargs)
      parsed.update(args_parsed)
  
      # fill default values
      default = {
          k: v.default
          for k, v in sig.parameters.items()
          if v.default != _empty
      }
  
      to_add = set(default.keys()) - set(parsed.keys())
  
      default_to_add = {k: v for k, v in default.items() if k in to_add}
      parsed.update(default_to_add)
  
      return parsed
  
imports: from copy import copy
  from inspect import signature, _empty
  import re
  from collections.abc import Iterable
  from collections import defaultdict
  from itertools import product
  from six import string_types
label_desc: Use image node_id 16 for calling a global function with example usage: map_parameters_in_fn_call(args, kwargs, func) and returns: parsed