def transform_results(results, func):
    """Transform a list of (timestamp,value) pairs by applying a function to the
    value."""
    try:
        for i in range(len(results)):
            results[i][1] = func(results[i][1])
    except TypeError:
        return func(results)
    return results
