code: def monotonic(values, mode="<", atol=1.e-8):
      
      if len(values) == 1:
          return True
  
      if mode == ">":
          for i in range(len(values)-1):
              v, vp = values[i], values[i+1]
              if abs(vp - v) > atol and vp <= v:
                  return False
  
      elif mode == "<":
          for i in range(len(values)-1):
              v, vp = values[i], values[i+1]
              if abs(vp - v) > atol and vp >= v:
                  return False
  
      else:
          raise ValueError("Wrong mode %s" % str(mode))
  
      return True
docs: Returns False if values are not monotonic (decreasing|increasing).
      mode is "<" for a decreasing sequence, ">" for an increasing sequence.
      Two numbers are considered equal if they differ less that atol.
  
      .. warning:
          Not very efficient for large data sets.
  
      >>> values = [1.2, 1.3, 1.4]
      >>> monotonic(values, mode="<")
      False
      >>> monotonic(values, mode=">")
      True