code: def _next_non_masked_element(a, idx):
      
      try:
          next_idx = idx + a[idx:].mask.argmin()
          if ma.is_masked(a[next_idx]):
              return None, None
          else:
              return next_idx, a[next_idx]
      except (AttributeError, TypeError, IndexError):
          return idx, a[idx]
docs: Return the next non masked element of a masked array.
  
      If an array is masked, return the next non-masked element (if the given index is masked).
      If no other unmasked points are after the given masked point, returns none.
  
      Parameters
      ----------
      a : array-like
          1-dimensional array of numeric values
      idx : integer
          index of requested element
  
      Returns
      -------
          Index of next non-masked element and next non-masked element