code: def parameters_by_signature(instance, signature_filter=None):
      """Get a dict of the parameters used to create an instance of a class. This is only suited for
      classes whose attributes are named according to their input parameters
  
      Parameters
      ----------
      instance: Class instance
          Instance of a class that has attributes named for the class's input parameters
      signature_filter: Callable, or None, default=None
          If not None, should be callable that expects as input (<arg_name>, <arg_val>), which are
          signature parameter names, and values, respectively. The callable should return a boolean:
          True if the pair should be added to `params`, or False if it should be ignored. If
          `signature_filter` is None, all signature parameters will be added to `params`
  
      Returns
      -------
      params: Dict
          Mapping of input parameters in class's `__init__` signature to instance attribute values
      """
      signature_filter = signature_filter or (lambda _name, _val: True)
      params = dict()
      signature_args = sorted(
          signature(instance.__class__).parameters.items()
      )
  
      for arg_name, arg_val in signature_args:
          if signature_filter(arg_name, arg_val):
              try:
                  temp_val = getattr(instance, arg_name)
                  params[arg_name] = (
                      temp_val if temp_val is not _empty else None
                  )
              except AttributeError:
                  params[arg_name] = (
                      arg_val.default
                      if arg_val.default is not _empty
                      else None
                  )
  
      return params
  
file_path: hyperparameter_hunter/hyperparameter_hunter/compat/keras_helper.py
imports: from hyperparameter_hunter.settings import G
  from hyperparameter_hunter.utils.general_utils import to_snake_case, subdict
  from inspect import signature, _empty
  from types import MethodType
  from typing import List, Tuple
label_desc: Use image node_id 6 for calling a global function with example usage: parameters_by_signature(instance, signature_filter) and returns: params