<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)