code: def area2cf(
      data_arr: xr.DataArray,
      include_lonlats: bool = False,
      got_lonlats: bool = False,
  ) -> list[xr.DataArray]:
      """Convert an area to at CF grid mapping or lon and lats."""
      res = []
      include_lonlats = include_lonlats or isinstance(
          data_arr.attrs["area"], SwathDefinition
      )
      is_area_def = isinstance(data_arr.attrs["area"], AreaDefinition)
      if not got_lonlats and include_lonlats:
          data_arr = _add_lonlat_coords(data_arr)
      if is_area_def:
          data_arr, gmapping = _add_grid_mapping(data_arr)
          res.append(gmapping)
      res.append(data_arr)
      return res
  
imports: import logging
  import xarray
  from packaging.version import Version
  from pyresample.geometry import AreaDefinition, SwathDefinition
label_desc: Use image node_id 4 for calling a global function with example usage: area2cf(data_arr, include_lonlats, got_lonlats) and returns: res