code: def profiler_dataclass_to_flat_dict(
      data: Union[SystemResourceMetrics, TorchProfilerMetrics]
  ) -> Dict:
      """Returns a flat dictionary representation, with the device_usage key removed."""
      nested_dict = dataclasses.asdict(data)
      nested_dict[""] = nested_dict.pop("device_usage")
      return flatten_dict(nested_dict, sep="")
  
file_path: ludwig/ludwig/benchmarking/profiler_dataclasses.py
imports: import dataclasses
  from dataclasses import dataclass
  from typing import Dict, Union
  from ludwig.utils.data_utils import flatten_dict
label_desc: Use image node_id 1 for calling a global function with example usage: profiler_dataclass_to_flat_dict(data) and returns: flatten_dict