code: def _add_metadata_as_attrs(data, units, description, dtype_out_vert):
      
      if isinstance(data, xr.DataArray):
          return _add_metadata_as_attrs_da(data, units, description,
                                           dtype_out_vert)
      else:
          for name, arr in data.data_vars.items():
              _add_metadata_as_attrs_da(arr, units, description,
                                        dtype_out_vert)
          return data
docs: Add metadata attributes to Dataset or DataArray