code: def nonNegativeDerivative(requestContext, seriesList, maxValue=None):
      
      results = []
  
      for series in seriesList:
          newValues = []
          prev = None
  
          for val in series:
              if None in (prev, val):
                  newValues.append(None)
                  prev = val
                  continue
  
              diff = val - prev
              if diff >= 0:
                  newValues.append(diff)
              elif maxValue is not None and maxValue >= val:
                  newValues.append((maxValue - prev) + val + 1)
              else:
                  newValues.append(None)
  
              prev = val
  
          newName = "nonNegativeDerivative(%s)" % series.name
          newSeries = TimeSeries(newName, series.start, series.end, series.step,
                                 newValues)
          newSeries.pathExpression = newName
          results.append(newSeries)
  
      return results
docs: Same as the derivative function above, but ignores datapoints that trend
      down. Useful for counters that increase for a long time, then wrap or
      reset. (Such as if a network interface is destroyed and recreated by
      unloading and re-loading a kernel module, common with USB / WiFi cards.
  
      Example::
  
          &target=nonNegativederivative(
              company.server.application01.ifconfig.TXPackets)