def reverse_order(order_array):
    """
    Returns the effective 'inverse' of the given order array, that is by
    returning the order array that would be needed to re-arrange back to the
    correct order.
    """
    if not hasattr(order_array, '__iter__'):
        raise TypeError('Non-iterable type passed as order_array argument.')
    length = len(order_array)
    new_array = [None] * length
    for index, replace in enumerate(order_array):
        new_array[replace] = index
    return new_array
