def perSecond(requestContext, seriesList, maxValue=None):
    """
    NonNegativeDerivative adjusted for the series time interval
    This is useful for taking a running total metric and showing how many
    requests per second were handled.

    Example::

        &target=perSecond(company.server.application01.ifconfig.TXPackets)

    Each time you run ifconfig, the RX and TXPackets are higher (assuming there
    is network traffic.) By applying the nonNegativeDerivative function, you
    can get an idea of the packets per minute sent or received, even though
    you're only recording the total.
    """
    results = []
    for series in seriesList:
        newValues = []
        prev = None
        step = series.step
        for val in series:
            if prev is None:
                newValues.append(None)
                prev = val
                continue
            if val is None:
                newValues.append(None)
                step = step * 2
                continue

            diff = val - prev
            if diff >= 0:
                newValues.append(diff / step)
            elif maxValue is not None and maxValue >= val:
                newValues.append(((maxValue - prev) + val + 1) / step)
            else:
                newValues.append(None)

            step = series.step
            prev = val
        newName = "perSecond(%s)" % series.name
        newSeries = TimeSeries(newName, series.start, series.end, series.step,
                               newValues)
        newSeries.pathExpression = newName
        results.append(newSeries)
    return results

    NonNegativeDerivative adjusted for the series time interval
    This is useful for taking a running total metric and showing how many
    requests per second were handled.

    Example::

        &target=perSecond(company.server.application01.ifconfig.TXPackets)

    Each time you run ifconfig, the RX and TXPackets are higher (assuming there
    is network traffic.) By applying the nonNegativeDerivative function, you
    can get an idea of the packets per minute sent or received, even though
    you're only recording the total.
    
graphite_api/functions.py