def get_transpositions(array):
    """
    Generator that iterates through all possible transpositions of
    an n-dimensional array.
    """
    axes = range(len(array.shape))
    for i in axes:
        yield tuple(axes[i:] + axes[:i])
