code: def _try_get_units_from_coords(data_arr: xr.DataArray) -> str | None:
      """Try to retrieve coordinate x/y units."""
      for c in ["x", "y"]:
          with suppress(KeyError):
              # If the data has only 1 dimension, it has only one of x or y coords
              if "units" in data_arr.coords[c].attrs:
                  return data_arr.coords[c].attrs["units"]
      return None
  
imports: from __future__ import annotations
  import logging
  import warnings
  from collections import defaultdict
  from contextlib import suppress
  import numpy
  import xarray
  from dask.base import tokenize
  from pyproj import CRS
  from pyresample.geometry import AreaDefinition, SwathDefinition
label_desc: Use image node_id 6 for calling a global function with example usage: _try_get_units_from_coords(data_arr) and returns: None, data_arr