def aggregateLine(requestContext, seriesList, func='avg'):
    """
    Takes a metric or wildcard seriesList and draws a horizontal line
    based on the function applied to each series.

    Note: By default, the graphite renderer consolidates data points by
    averaging data points over time. If you are using the 'min' or 'max'
    function for aggregateLine, this can cause an unusual gap in the
    line drawn by this function and the data itself. To fix this, you
    should use the consolidateBy() function with the same function
    argument you are using for aggregateLine. This will ensure that the
    proper data points are retained and the graph should line up
    correctly.

    Example::

        &target=aggregateLine(server01.connections.total, 'avg')
        &target=aggregateLine(server*.connections.total, 'avg')

    """
    t_funcs = {'avg': safeAvg, 'min': safeMin, 'max': safeMax}

    if func not in t_funcs:
        raise ValueError("Invalid function %s" % func)

    results = []
    for series in seriesList:
        value = t_funcs[func](series)
        if value is not None:
            name = 'aggregateLine(%s, %g)' % (series.name, value)
        else:
            name = 'aggregateLine(%s, None)' % (series.name)

        [series] = constantLine(requestContext, value)
        series.name = name
        series.pathExpression = series.name
        results.append(series)
    return results
Takes a metric or wildcard seriesList and draws a horizontal line
    based on the function applied to each series.

    Note: By default, the graphite renderer consolidates data points by
    averaging data points over time. If you are using the 'min' or 'max'
    function for aggregateLine, this can cause an unusual gap in the
    line drawn by this function and the data itself. To fix this, you
    should use the consolidateBy() function with the same function
    argument you are using for aggregateLine. This will ensure that the
    proper data points are retained and the graph should line up
    correctly.

    Example::

        &target=aggregateLine(server01.connections.total, 'avg')
        &target=aggregateLine(server*.connections.total, 'avg')