code: def get_instance_with_redundant_kwargs(
      class_name, kwargs, module_paths=None
  ):
      """Creates a class instance.
  
      Only those keyword arguments in :attr:`kwargs` that are included in the
      class construction method are used.
  
      Args:
          class_name (str): A class or its name or module path.
          kwargs (dict): A dictionary of arguments for the class constructor. It
              may include invalid arguments which will be ignored.
          module_paths (list of str): A list of paths to candidate modules to
              search for the class. This is used if the class cannot be located
              solely based on :attr:`class_name`. The first module in the list
              that contains the class is used.
  
      Returns:
          A class instance.
  
      Raises:
          ValueError: If class is not found based on :attr:`class_name` and
              :attr:`module_paths`.
      """
      # Locate the class
      class_ = get_class(class_name, module_paths)
  
      # Select valid arguments
      selected_kwargs = {}
      class_args = set(get_args(class_.__init__))
      if kwargs is None:
          kwargs = {}
      for key, value in kwargs.items():
          if key in class_args:
              selected_kwargs[key] = value
  
      return class_(**selected_kwargs)
  
imports: from typing import List, Union
  import inspect
  import funcsigs
  from pydoc import locate
  import copy
  import collections
  import numpy
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils.dtypes import is_str, is_callable, compat_as_text, _maybe_list_to_array
label_desc: Use image node_id 10 for calling a global function with example usage: get_instance_with_redundant_kwargs(class_name, kwargs, module_paths) and returns: class_