def averageSeriesWithWildcards(requestContext, seriesList, *positions):
    matchedList = defaultdict(list)
    for series in seriesList:
        newname = '.'.join(map(lambda x: x[1],
                               filter(lambda i: i[0] not in positions,
                                      enumerate(series.name.split('.')))))
        matchedList[newname].append(series)
    result = []
    for name in matchedList:
        [series] = averageSeries(requestContext, (matchedList[name]))
        series.name = name
        result.append(series)
    return result
Call averageSeries after inserting wildcards at the given position(s).
dataset/ETHPy150Open brutasse/graphite-api/graphite_api/functions.py/averageSeriesWithWildcards