def with_suffix_applied(
        identities,
        suffix,
        applicator=lambda identity, suffix: identity + suffix,
):
    """Append a suffix to all identities."""
    return {
        'groups': {applicator(group_name, suffix) for group_name in identities['groups']},
        'users': {
            applicator(user_name, suffix): (
                applicator(pgroup_name, suffix),
                {applicator(sgroup_name, suffix) for sgroup_name in sgroup_names},
            )
            for user_name, (pgroup_name, sgroup_names) in identities['users'].items()
        },
        'proxy_users': {
            applicator(proxy_user_name, suffix): {
                (applicator(member_name, suffix), member_type)
                for member_name, member_type in members
            }
            for proxy_user_name, members in identities['proxy_users'].items()
        }
    }