code: def _get_extra_ds(dataarray, keys=None):
      """Get the ancillary_variables DataArrays associated to a dataset."""
      dict_datarrays = {}
      # Retrieve ancillary variable datarrays
      for ancillary_dataarray in dataarray.attrs.get(
          "ancillary_variables", []
      ):
          ancillary_variable = ancillary_dataarray.name
          if keys and ancillary_variable not in keys:
              keys.append(ancillary_variable)
              dict_datarrays.update(
                  _get_extra_ds(ancillary_dataarray, keys=keys)
              )
      # Add input dataarray
      dict_datarrays[dataarray.attrs["name"]] = dataarray
      return dict_datarrays
  
file_path: satpy/satpy/cf/datasets.py
imports: import logging
  import warnings
  import xarray
  from satpy.writers.cf_writer import CF_DTYPES, CF_VERSION
label_desc: Use image node_id 1 for calling a global function with example usage: _get_extra_ds(dataarray, keys) and returns: dict_datarrays