def parallel_bubble_sort_single_step(array, key, odd=False,
                                     system_side_length=None):
    """Give a layer of swaps as part of a sorting network for an array of
    positions.

    Args:
        array: An array of multi-dimensional positions to sort.
        key: The key function by which to determine ordering.
        odd: Whether or not to swap all odd entries with their even
             neighbor (whether to the right or down), e.g. swapping
             x[i][j] with x[i+1][j] or x[i][j+1] with i or j even, which
             happens when odd = False, or with i or j odd, which happens
             when odd = True.
        system_side_length: The integer side length of the n-cube from
                            which the positions in array are taken.
    """
    swaps_in_layer = []

    for i in range(int(odd), len(array) - 1, 2):
        if (key(system_side_length, array[i]) >
                key(system_side_length, array[i + 1])):
            array[i], array[i+1] = array[i+1], array[i]
            swaps_in_layer.append((i, i + 1))

    return swaps_in_layer