def _check_rect(n_x, n_y, dx, dy, symbol, M):
    """
    Check that for a rectangle defined by two of its sides, every element \
            within it is the same.

    .. note:: This method is called once the main script has reached the \
            limits of a rectangle.

    :param n_x: Starting position of the rectangle (top left corner abscissa).
    :param n_y: Starting position of the rectangle (top left corner ordonate).
    :param dx: Width of the rectangle.
    :param dy: Height of the rectangle.
    :param symbol: Symbol which should be in the rectangle.
    :param M: Input matrix, as a list of strings.
    :returns: Boolean indicated whether the rectangle is correct or not.
    """
    for x in range(dx):
        for y in range(dy):
            if M[n_y + y][n_x + x] != symbol:
                return False
    return True