def row_indices_snake(row, x_dimension):
    """Obtain the indices in a row from left to right in the
    2-d snake ordering."""
    indices = range(row * x_dimension, (row + 1) * x_dimension)
    if row % 2 != 0:
        indices = reversed(indices)
    return list(indices)