<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transformNull(requestContext, seriesList, default=0, referenceSeries=None):
 """ Takes a metric or wildcard seriesList and replaces null values with the value specified by `default`. The value 0 used if not specified. The optional referenceSeries, if specified, is a metric or wildcard series list that governs which time intervals nulls should be replaced. If specified, nulls are replaced only in intervals where a non-null is found for the same interval in any of referenceSeries. This method compliments the drawNullAsZero function in graphical mode, but also works in text-only mode. Example:: &target=transformNull(webapp.pages.*.views,-1) This would take any page that didn't have values and supply negative 1 as a default. Any other numeric value may be used as well. """

    def transform(v, d):
        if v is None:
            return d
        else:
            return v

    if referenceSeries:
        defaults = [default if any(v is not None for v in x) else None
                    for x in zip_longest(*referenceSeries)]
    else:
        defaults = None

    for series in seriesList:
        if referenceSeries:
            series.name = "transformNull(%s,%g,referenceSeries)" % (
                series.name, default)
        else:
            series.name = "transformNull(%s,%g)" % (series.name, default)
        series.pathExpression = series.name
        if defaults:
            values = [transform(v, d) for v, d in zip_longest(series,
                                                              defaults)]
        else:
            values = [transform(v, default) for v in series]
        series.extend(values)
        del series[:len(values)]
    return seriesList