code: def is_monotonic(a, increasing=True):
      
      a = np.asarray(a) # ensure a is array-like
  
      if a.ndim > 1:
          raise ValueError("not supported for multi-dimensonal arrays")
  
      if len(a) <= 1:
          return True
  
      if increasing:
          return np.all(a[1:] >= a[:-1], axis=0)
      return np.all(a[1:] <= a[:-1], axis=0)
docs: Tests whether a vector a has monotonicity.
  
      Parameters
      ----------
      a : array-like
          Array that should be tested for monotonicity
  
      increasing : bool, default: True
          Test if the array is montonically increasing, otherwise test if the
          array is montonically decreasing.