code: def _remove_z_mask(
      z: ArrayLike | np.ma.MaskedArray[Any, Any] | None,
  ) -> tuple[CoordinateArray, MaskArray | None]:
      # Preserve mask if present.
      z_array = np.ma.asarray(z, dtype=np.float64)  # type: ignore[no-untyped-call]
      z_masked = np.ma.masked_invalid(z_array, copy=False)  # type: ignore[no-untyped-call]
  
      if np.ma.is_masked(z_masked):  # type: ignore[no-untyped-call]
          mask = np.ma.getmask(z_masked)  # type: ignore[no-untyped-call]
      else:
          mask = None
  
      return np.ma.getdata(z_masked), mask
  
file_path: catboost/contrib/python/contourpy/contourpy/__init__.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  import numpy
  from contourpy._contourpy import ContourGenerator, FillType, LineType, Mpl2005ContourGenerator, Mpl2014ContourGenerator, SerialContourGenerator, ThreadedContourGenerator, ZInterp, max_threads
  from contourpy._version import __version__
  from contourpy.chunk import calc_chunk_sizes
  from contourpy.convert import convert_filled, convert_lines
  from contourpy.dechunk import dechunk_filled, dechunk_lines
  from contourpy.enum_util import as_fill_type, as_line_type, as_z_interp
label_desc: Use image node_id 1 for calling a global function with example usage: _remove_z_mask(z) and returns: np,  mask