docs: def matrix_iter(matrix, version, scale=1, border=None):
      """\
      Returns an iterator / generator over the provided matrix which includes
      the border and the scaling factor.
  
      If either the `scale` or `border` value is invalid, a :py:exc:`ValueError`
      is raised.
  
      :param matrix: An iterable of bytearrays.
      :param int version: A version constant.
      :param int scale: The scaling factor (default: ``1``).
      :param int border: The border size or ``None`` to specify the
              default quiet zone (4 for QR Codes, 2 for Micro QR Codes).
      :raises: :py:exc:`ValueError` if an illegal scale or border value is provided
      """
      check_valid_border(border)
      scale = int(scale)
      check_valid_scale(scale)
      border = get_border(version, border)
      width, height = get_symbol_size(version, scale=1, border=0)
  
      def get_bit(i, j):
          return 0x1 if (0 <= i < height and 0 <= j < width and matrix[i][j]) else 0x0
  
      for i in range(-border, height + border):
          for s in range(scale):
              yield chain.from_iterable(([get_bit(i, j)] * scale for j in range(-border, width + border)))