code: def _filter_mutated_params_from_config(
      config: Dict, hyperparam_mutations: Dict
  ) -> Dict:
      """Filter out hyperparameters from a config so that only parameters specified
      within hyperparam_mutations remain. This recursively filters nested configs.
  
      Example:
      >>> config = {
      ...     "a": {"b": 2, "c": 0, "d": {"e": 0.1}},
      ...     "f": {"g": 0.5},
      ... }
      >>> hyperparam_mutations = {
      ...     "a": {"b": [1, 2], "c": [-1, 0]},
      ... }
      >>> _filter_mutated_params_from_config(config, hyperparam_mutations) == {
      ...     "a": {"b": 2, "c": 0}
      ... }
      True
  
      Args:
          config: The config dict that we want to filter.
          hyperparam_mutations: A dict containing a subset of hyperparameters from
              config, used to filter the config.
  
      Returns:
          mutated_params: A copy of config containing only params specified in
              hyperparam_mutations
      """
      mutated_params = {}
      for param_name in config:
          if param_name not in hyperparam_mutations:
              continue
  
          if isinstance(config[param_name], dict):
              nested_params = _filter_mutated_params_from_config(
                  config[param_name], hyperparam_mutations[param_name]
              )
              mutated_params[param_name] = nested_params
          else:
              mutated_params[param_name] = config[param_name]
      return mutated_params
  
imports: import copy
  import json
  import logging
  import math
  import os
  import random
  import shutil
  import warnings
  from pathlib import Path
  from typing import Callable, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  from ray.air.constants import TRAINING_ITERATION
  from ray.train import Checkpoint
  from ray.train._internal.session import _TrainingResult, _FutureTrainingResult
  from ray.tune.error import TuneError
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.search import SearchGenerator
  from ray.tune.utils.util import SafeFallbackEncoder
  from ray.tune.search.sample import Domain, Function
  from ray.tune.schedulers import FIFOScheduler, TrialScheduler
  from ray.tune.search.variant_generator import format_vars
  from ray.tune.experiment import Trial
  from ray.util import PublicAPI
  from ray.util.debug import log_once
label_desc: Use image node_id 4 for calling a global function with example usage: _filter_mutated_params_from_config(config, hyperparam_mutations) and returns: mutated_params