def validate_newaxes(old_axes, new_axes):
    """ Validate axes string when changing the order/transposing axes

    This function confirms that:
        1. every character in the new_axes exists in the old_axes
        2. there is the same number of characters (ndims isn't changing)
        3. all of the old_axes are represented in the new_axes
    """
    for char in new_axes:
        if char not in old_axes:
            raise ValueError('Axis "{}" not in current axes: "{}"'.format(
                char, old_axes))
    if len(new_axes) != len(old_axes):
        raise ValueError('Cannot change axes dimensions from "{}" to "{}".'
            .format(len(old_axes), len(new_axes)))
    if not set(new_axes) == set(old_axes):
        raise ValueError('Error: unassigned axes remaining: {}'.format(set(
            old_axes) - set(new_axes)))
