Validate that all rows have the same length.

def validate_rows_length(data, length, message=None, exception=MatrixError):
    """Validate that all rows have the same length."""
    if message is None:
        message = 'All rows must have the same length (same number of columns)'
    for row in data:
        if len(row) != length:
            raise exception(message)