code: def create_extras(cls: Type[T],
                    extras: Dict[str, Any]) -> Dict[str, Any]:
      
      subextras: Dict[str, Any] = {}
      if hasattr(cls, "from_params"):
          from_params_method = cls.from_params  # type: ignore
      else:
          # In some rare cases, we get a registered subclass that does _not_ have a
          # from_params method (this happens with Activations, for instance, where we
          # register pytorch modules directly).  This is a bit of a hack to make those work,
          # instead of adding a `from_params` method for them somehow. Then the extras
          # in the class constructor are what we are looking for, to pass on.
          from_params_method = cls
      if takes_kwargs(from_params_method):
          # If annotation.params accepts **kwargs, we need to pass them all along.
          # For example, `BasicTextFieldEmbedder.from_params` requires a Vocabulary
          # object, but `TextFieldEmbedder.from_params` does not.
          subextras = extras
      else:
          # Otherwise, only supply the ones that are actual args; any additional ones
          # will cause a TypeError.
          subextras = {k: v for k, v in extras.items()
                       if takes_arg(from_params_method, k)}
      return subextras
docs: Given a dictionary of extra arguments, returns a dictionary of
      kwargs that actually are a part of the signature of the cls.from_params
      (or cls) method.