code: def _parse_params(params, default_params):
      """Parses parameter values to the types defined by the default parameters.
      Default parameters are used for missing values.
      """
      # Cast parameters to correct types
      if params is None:
          params = {}
      result = copy.deepcopy(default_params)
      for key, value in params.items():
          # If param is unknown, drop it to stay compatible with past versions
          if key not in default_params:
              raise ValueError(
                  "%s is not a valid model parameter" % key
              )
          # Param is a dictionary
          if isinstance(value, dict):
              default_dict = default_params[key]
              if not isinstance(default_dict, dict):
                  raise ValueError("%s should not be a dictionary", key)
              if default_dict:
                  value = _parse_params(value, default_dict)
              else:
                  # If the default is an empty dict we do not typecheck it
                  # and assume it's done downstream
                  pass
          if value is None:
              continue
          if default_params[key] is None:
              result[key] = value
          else:
              result[key] = type(default_params[key])(value)
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import copy
  from pydoc import locate
  import six
  import yaml
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: _parse_params(params, default_params) and returns: result