@staticmethod
def _avg(value1, value2, weight):
    """Returns the weighted average of two values and handles the case where
            one value is None. If both values are None, None is returned.
        """
    if value1 is None:
        return value2
    if value2 is None:
        return value1
    return value2 * weight + value1 * (1 - weight)
