code: def _instantiate(cls, params):
      
      sig_params = inspect.signature(cls.__init__).parameters
      valid_params = dict()
      for key, value in params.items():
          if key in sig_params:
              valid_params[key] = value
          else:
              logger.debug('Type %s does not support parameter \'%s\'' % (cls.__name__, key))
      return cls(**valid_params)
docs: Helper to instantiate Attention classes from parameters. Warns in log if parameter is not supported
      by class constructor.
  
      :param cls: Attention class.
      :param params: configuration parameters.
      :return: instance of `cls` type.