code: def kwargs_to_args(
      self, *, kwargs, to_dict=False, outer_tuple=False, is_outer=True
  ):
      if self.is_singleton():
          spec = self.singleton()
          if isinstance(spec, self.value_type):
              if isinstance(
                  kwargs, (tf.IndexedSlices, tf.Tensor, tf.Variable)
              ):
                  # Special case: API input arguments are raw values, not singleton dicts
                  assert spec.is_compatible_with(
                      spec_or_tensor=kwargs
                  ), (spec, kwargs)
                  return kwargs
              else:
                  assert (
                      isinstance(kwargs, TensorDict)
                      and kwargs.is_singleton()
                  )
                  arg = kwargs.singleton()
                  assert isinstance(
                      arg, (tf.IndexedSlices, tf.Tensor, tf.Variable)
                  )
                  assert spec.is_compatible_with(spec_or_tensor=arg), (
                      spec,
                      arg,
                  )
                  return arg
          else:
              return spec.kwargs_to_args(
                  kwargs=kwargs, to_dict=to_dict, is_outer=False
              )
  
      else:
          if is_outer:
              assert isinstance(kwargs, (dict, list, tuple))
          else:
              assert isinstance(kwargs, TensorDict), (self, kwargs)
          if to_dict:
              args = dict()
          else:
              args = list()
          for index, (name, spec) in enumerate(
              super(NestedDict, self).items()
          ):
              if is_outer and isinstance(kwargs, (list, tuple)):
                  if index < len(kwargs):
                      arg = kwargs[index]
              elif name in kwargs:
                  arg = kwargs[name]
              if isinstance(spec, self.value_type):
                  assert isinstance(
                      arg, (tf.IndexedSlices, tf.Tensor, tf.Variable)
                  )
                  if isinstance(arg, tf.IndexedSlices):
                      # TODO: why does IndexedSlicesSpec not work?
                      # spec = tf.IndexedSlicesSpec(
                      #     shape=spec.shape, dtype=spec.dtype, indices_dtype=arg.indices.dtype
                      # )
                      # assert spec.is_compatible_with(spec_or_value=arg), (name, spec, arg)
                      assert tf.TensorSpec(
                          shape=((None,) + spec.shape[1:]),
                          dtype=spec.dtype,
                      ).is_compatible_with(spec_or_tensor=arg.values)
                      assert tf.TensorSpec(
                          shape=(None,), dtype=arg.indices.dtype
                      ).is_compatible_with(spec_or_tensor=arg.indices)
                  else:
                      assert spec.is_compatible_with(
                          spec_or_tensor=arg
                      ), (name, spec, arg)
                  if to_dict:
                      args[name] = arg
                  else:
                      args.append(arg)
              elif len(spec) == 0:
                  continue
              else:
                  arg = spec.kwargs_to_args(
                      kwargs=arg, to_dict=to_dict, is_outer=False
                  )
                  if to_dict:
                      args[name] = arg
                  else:
                      args.append(arg)
          if to_dict:
              if outer_tuple and is_outer:
                  args = tuple(args.values())
          else:
              args = tuple(args)
          return args
  
imports: from collections import OrderedDict
  import numpy
  import tensorflow
  from tensorflow.python.training.tracking.tracking import AutoTrackable
  from tensorflow.python.training.tracking.data_structures import sticky_attribute_assignment
  from tensorforce.core.utils import NestedDict
label_desc: Use image node_id 6 for calling the SignatureDict obj's underlying member method code with example usage: obj.kwargs_to_args() and returns: args, spec, kwargs, arg