code: def extract_grouped_input_state_callback_args_from_kwargs(kwargs):
      input_parameters = kwargs["inputs"]
      if isinstance(input_parameters, DashDependency):
          input_parameters = [input_parameters]
  
      state_parameters = kwargs.get("state", None)
      if isinstance(state_parameters, DashDependency):
          state_parameters = [state_parameters]
  
      if isinstance(input_parameters, dict):
          # Wrapped function will be called with named keyword arguments
          if state_parameters:
              if not isinstance(state_parameters, dict):
                  raise ValueError(
                      "The input argument to app.callback was a dict, "
                      "but the state argument was not.\n"
                      "input and state arguments must have the same type"
                  )
  
              # Merge into state dependencies
              parameters = state_parameters
              parameters.update(input_parameters)
          else:
              parameters = input_parameters
  
          return parameters
  
      if isinstance(input_parameters, (list, tuple)):
          # Wrapped function will be called with positional arguments
          parameters = list(input_parameters)
          if state_parameters:
              if not isinstance(state_parameters, (list, tuple)):
                  raise ValueError(
                      "The input argument to app.callback was a list, "
                      "but the state argument was not.\n"
                      "input and state arguments must have the same type"
                  )
  
              parameters += list(state_parameters)
  
          return parameters
  
      raise ValueError(
          "The input argument to app.callback may be a dict, list, or tuple,\n"
          f"but received value of type {type(input_parameters)}"
      )
  
imports: import json
  from dash.development.base_component import Component
  from ._validate import validate_callback
  from ._grouping import flatten_grouping, make_grouping_by_index
label_desc: Use image node_id 2 for calling a global function with example usage: extract_grouped_input_state_callback_args_from_kwargs(kwargs) and returns: parameters, parameters