docs: def matrix_to_lines(matrix, x, y, incby=1):
      """\
      Converts the `matrix` into an iterable of ((x1, y1), (x2, y2)) tuples which
      represent a sequence (horizontal line) of dark modules.
  
      The path starts at the 1st row of the matrix and moves down to the last
      row.
  
      :param matrix: An iterable of bytearrays.
      :param x: Initial position on the x-axis.
      :param y: Initial position on the y-axis.
      :param incby: Value to move along the y-axis (default: 1).
      :rtype: iterable of (x1, y1), (x2, y2) tuples
      """
      y -= incby  # Move along y-axis so we can simply increment y in the loop
      last_bit = 0x1
      for row in matrix:
          x1 = x
          x2 = x
          y += incby
          for bit in row:
              if last_bit != bit and not bit:
                  yield (x1, y), (x2, y)
                  x1 = x2
              x2 += 1
              if not bit:
                  x1 += 1
              last_bit = bit
          if last_bit:
              yield (x1, y), (x2, y)
              last_bit = 0x0