code: def filter_search_space(
      hyperparameters: Dict, keys_to_filter: Union[str, List[str]]
  ):
      """
      Filter search space within hyperparameters without the given keys as prefixes.
      Hyperparameters that are not search space will not be filtered.
  
      Parameters
      ----------
      hyperparameters
          A dictionary containing search space and overrides to config.
      keys_to_filter
          Keys that needs to be filtered out
  
      Returns
      -------
          hyperparameters being filtered
      """
      if isinstance(keys_to_filter, str):
          keys_to_filter = [keys_to_filter]
  
      assert any(
          key.startswith(valid_keys)
          for valid_keys in VALID_CONFIG_KEYS
          for key in keys_to_filter
      ), f"Invalid keys: {keys_to_filter}. Valid options are {VALID_CONFIG_KEYS}"
      from ray.tune.search.sample import Domain
  
      from autogluon.common import space
  
      hyperparameters = copy.deepcopy(hyperparameters)
      for hyperparameter, value in hyperparameters.copy().items():
          if not isinstance(value, (space.Space, Domain)):
              continue
          for key in keys_to_filter:
              if hyperparameter.startswith(key):
                  del hyperparameters[hyperparameter]
      return hyperparameters
  
imports: import copy
  import logging
  import os
  import re
  import warnings
  from typing import Callable, Dict, List, Optional, Tuple, Union
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
  from torch import nn
  from ..constants import AUTOMM, DATA, FT_TRANSFORMER, FUSION_TRANSFORMER, HF_MODELS, MODEL, REGRESSION, VALID_CONFIG_KEYS
  from ..presets import get_automm_presets, get_basic_automm_config
  from .data import get_detected_data_types
label_desc: Use image node_id 1 for calling a global function with example usage: filter_search_space(hyperparameters, keys_to_filter) and returns: hyperparameters