code: def _get_mask_from_nan(X):
      nan_col = np.all(np.isnan(X), axis=0)
      nan_row = np.all(np.isnan(X), axis=1)
      if not np.array_equal(nan_col, nan_row):
          raise ValueError("NaN values are not symmetric.")
      nan_inds = np.where(nan_col)
      subX_ = np.delete(X, nan_inds, axis=0)
      subX = np.delete(subX_, nan_inds, axis=1)
      if np.any(np.isnan(subX)):
          raise ValueError("NaN values must fill rows and columns.")
      mask = np.delete(np.eye(X.shape[0]), nan_inds, axis=1)
      return mask
  
imports: from copy import deepcopy
  import numpy
  import warnings
  from .ajd import ajd_pham
  from .base import sqrtm, invsqrtm, logm, expm, powm
  from .distance import distance_riemann
  from .geodesic import geodesic_riemann
  from .utils import check_weights
label_desc: Use image node_id 15 for calling a global function with example usage: _get_mask_from_nan(X) and returns: mask