code: def nanpercentile(values, q, axis, na_value, mask, ndim, interpolation):
      
      if not lib.is_scalar(mask) and mask.any():
          if ndim == 1:
              return _nanpercentile_1d(values, mask, q, na_value,
                                       interpolation=interpolation)
          else:
              # for nonconsolidatable blocks mask is 1D, but values 2D
              if mask.ndim < values.ndim:
                  mask = mask.reshape(values.shape)
              if axis == 0:
                  values = values.T
                  mask = mask.T
              result = [_nanpercentile_1d(val, m, q, na_value,
                                          interpolation=interpolation)
                        for (val, m) in zip(list(values), list(mask))]
              result = np.array(result, dtype=values.dtype, copy=False).T
              return result
      else:
          return np.percentile(values, q, axis=axis, interpolation=interpolation)
docs: Wraper for np.percentile that skips missing values.
  
      Parameters
      ----------
      values : array over which to find quantiles
      q : scalar or array of quantile indices to find
      axis : {0, 1}
      na_value : scalar
          value to return for empty or all-null values
      mask : ndarray[bool]
          locations in values that should be considered missing
      ndim : {1, 2}
      interpolation : str
  
      Returns
      -------
      quantiles : scalar or array