docs: def undo_filter(self, filter_type, line):
          """
          Undo the filter for a scanline.
  
          `scanline` is a sequence of bytes that does not include
          the initial filter type byte.
  
          The scanline will have the effects of filtering removed.
          Scanline modified inplace and also returned as result.
          """
          assert 0 <= filter_type <= 4
          # For the first line of a pass, synthesize a dummy previous line.
          if self.prev is None:
              self.prev = newBarray(len(line))
              # Also it's possible to switch some filters to easier
              if filter_type == 2:  # "up"
                  filter_type = 0
              elif filter_type == 4:  # "paeth"
                  filter_type = 1
  
          # Call appropriate filter algorithm.
          # 0 - do nothing
          if filter_type == 1:
              self.__undo_filter_sub(line)
          elif filter_type == 2:
              self.__undo_filter_up(line)
          elif filter_type == 3:
              self.__undo_filter_average(line)
          elif filter_type == 4:
              self.__undo_filter_paeth(line)
  
          # This will not work writing cython attributes from python
          # Only 'cython from cython' or 'python from python'
          self.prev[:] = line[:]
          return line