Print packages that've been added, removed or changed

def display_package_changes(pre_packages, post_packages, indent=''):
    """
    Print packages that've been added, removed or changed
    """
    # use package name to determine what's changed
    pre_package_names = {p.name: p for p in pre_packages}
    post_package_names = {p.name: p for p in post_packages}

    added = set(post_package_names.keys()) - set(pre_package_names.keys())
    removed = set(pre_package_names.keys()) - set(post_package_names.keys())
    changed_maybe = set(pre_package_names.keys()) & set(post_package_names.keys())

    changed = []
    for package_name in sorted(changed_maybe):
        if pre_package_names[package_name] != post_package_names[package_name]:
            changed.append((pre_package_names[package_name], post_package_names[package_name]))

    if not (added or removed or changed):
        echo_info('{}No changes'.format(indent))

    if added:
        echo_success('{}Added packages:'.format(indent))
        for package_name in sorted(added):
            echo_info('{}    {}'.format(indent, post_package_names[package_name]))

    if removed:
        echo_failure('{}Removed packages:'.format(indent))
        for package_name in sorted(removed):
            echo_info('{}    {}'.format(indent, pre_package_names[package_name]))

    if changed:
        echo_warning('{}Changed packages:'.format(indent))
        for pre, post in changed:
            echo_info('{}    {} -> {}'.format(indent, pre, post))