code: def _add_dataclasses_by_fields(
      dataclass1, dataclass2, fields_to_ignore: List[str]
  ) -> None:
      """Recursively adds all numerical fields of one dataclass to another.
  
      The result is stored in dataclass1. dataclass2 is unmodified.
  
      Assumptions:
        1. dataclass1 and dataclass2 are instances of the same dataclass type.
        2. all fields which should be processed (i.e. not in fields_to_ignore)
          are either dataclasses or support + operator.
        3. For all dataclasses fields assumptions 1,2 apply.
  
      Attributes:
          dataclass1, dataclass2: instances of the same dataclass type.
          fields_to_ignore: field names which should be ignored.
      """
      assert type(dataclass1) == type(
          dataclass2
      ), f"type(dataclass1) = {type(dataclass1)} != type(dataclass2) = {type(dataclass2)}"
      fields = dataclasses.fields(dataclass1)
      for field in fields:
          if field.name in fields_to_ignore:
              continue
          value1 = getattr(dataclass1, field.name)
          if value1 is None:
              continue
          value2 = getattr(dataclass2, field.name)
          if dataclasses.is_dataclass(value1):
              _add_dataclasses_by_fields(
                  value1, value2, fields_to_ignore
              )
              continue
          setattr(dataclass1, field.name, value1 + value2)
  
imports: import copy
  import pipeline_dp
  from analysis import metrics
  import dataclasses
  from typing import List, Tuple, Callable
  import math
label_desc: Use image node_id 7 for calling a global function with example usage: _add_dataclasses_by_fields(dataclass1, dataclass2, fields_to_ignore) without return types