<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __undo_filter_average(self, scanline):
 """Undo average filter."""

        ai = -self.fu
        previous = self.prev
        for i in range(len(scanline)):
            x = scanline[i]
            if ai < 0:
                a = 0
            else:
                a = scanline[ai]  # result
            b = previous[i]
            scanline[i] = (x + ((a + b) >> 1)) & 0xff  # result
            ai += 1