code: def select_matching_signature(funcs, *args, **kwargs):
      """
      Select and call the function that accepts ``*args, **kwargs``.
  
      *funcs* is a list of functions which should not raise any exception (other
      than `TypeError` if the arguments passed do not match their signature).
  
      `select_matching_signature` tries to call each of the functions in *funcs*
      with ``*args, **kwargs`` (in the order in which they are given).  Calls
      that fail with a `TypeError` are silently skipped.  As soon as a call
      succeeds, `select_matching_signature` returns its return value.  If no
      function accepts ``*args, **kwargs``, then the `TypeError` raised by the
      last failing call is re-raised.
  
      Callers should normally make sure that any ``*args, **kwargs`` can only
      bind a single *func* (to avoid any ambiguity), although this is not checked
      by `select_matching_signature`.
  
      Notes
      -----
      `select_matching_signature` is intended to help implementing
      signature-overloaded functions.  In general, such functions should be
      avoided, except for back-compatibility concerns.  A typical use pattern is
      ::
  
          def my_func(*args, **kwargs):
              params = select_matching_signature(
                  [lambda old1, old2: locals(), lambda new: locals()],
                  *args, **kwargs)
              if "old1" in params:
                  warn_deprecated(...)
                  old1, old2 = params.values()  # note that locals() is ordered.
              else:
                  new, = params.values()
              # do things with params
  
      which allows *my_func* to be called either with two parameters (*old1* and
      *old2*) or a single one (*new*).  Note that the new signature is given
      last, so that callers get a `TypeError` corresponding to the new signature
      if the arguments they passed in do not match any signature.
      """
      # Rather than relying on locals() ordering, one could have just used func's
      # signature (``bound = inspect.signature(func).bind(*args, **kwargs);
      # bound.apply_defaults(); return bound``) but that is significantly slower.
      for i, func in enumerate(funcs):
          try:
              return func(*args, **kwargs)
          except TypeError:
              if i == len(funcs) - 1:
                  raise
  
imports: import functools
  import itertools
  import re
  import sys
  import warnings
  from .deprecation import deprecated, warn_deprecated, rename_parameter, delete_parameter, make_keyword_only, deprecate_method_override, deprecate_privatize_attribute, suppress_matplotlib_deprecation_warning, MatplotlibDeprecationWarning
label_desc: Use image node_id 7 for calling a global function with example usage: select_matching_signature(funcs) and returns: func