code: def clone_without_metrics(
      data: Data, excluded_metric_names: Iterable[str]
  ) -> Data:
      """Returns a new data object where rows containing the outcomes specified by
      `metric_names` are filtered out. Used to sanitize data before using it as
      training data for a model that requires data rectangularity.
  
      Args:
          data: Original data to clone.
          excluded_metric_names: Metrics to avoid copying
  
      Returns:
          new version of the original data without specified metrics.
      """
      return Data(
          df=data.df[
              data.df["metric_name"].apply(
                  lambda n: n not in excluded_metric_names
              )
          ].copy()
      )
  
imports: from __future__ import annotations
  import json
  from abc import abstractmethod
  from functools import reduce
  from hashlib import md5
  from typing import Any, Dict, Iterable, List, Optional, Set, Type, TypeVar, Union
  import numpy
  import pandas
  from ax.core.types import TFidelityTrialEvaluation, TTrialEvaluation
  from ax.utils.common.base import Base
  from ax.utils.common.serialization import extract_init_args, SerializationMixin, serialize_init_args, TClassDecoderRegistry, TDecoderRegistry
  from ax.utils.common.typeutils import checked_cast, not_none
label_desc: Use image node_id 2 for calling a global function with example usage: clone_without_metrics(data, excluded_metric_names) and returns: Data