def transformNull(requestContext, seriesList, default=0):
    def transform(v):
        if v is None:
            return default
        else:
            return v

    for series in seriesList:
        series.name = "transformNull(%s,%g)" % (series.name, default)
        series.pathExpression = series.name
        values = [transform(v) for v in series]
        series.extend(values)
        del series[:len(values)]
    return seriesList
Takes a metric or wild card seriesList and an optional value
dataset/ETHPy150Open brutasse/graphite-api/graphite_api/functions.py/transformNull