Exclude One Category and its Subcategories using WP_LIST_FILTER

I am answering a question after like 6 months, so I expect the quality of my answer not upto WPSE standards and hence would love feedback from other experience WPSE gurus.

Add the following function to your functions.php

function filter_category_list_by_slug( $slug, $categories ) {
    $excluded_parent = get_category_by_slug( $slug );
    $excluded_cats = get_categories( array( 'child_of' => $excluded_parent->term_id ) );
    $excluded_cats[] = $excluded_parent;
    $filtered = array();
    $matched = false;
    foreach ($categories as $category ) {
        $matched = false;
        foreach( $excluded_cats as $ex_cat ) {
            if ( $category->term_id == $ex_cat->term_id ) {
                $matched = true;
            }
        }
        if ( ! $matched ) {
            $filtered[] = $category;
        }
    }
    return $filtered;
}

And the filter the category list like following:

$categories = wp_get_post_terms($post->ID, 'category');
$categories = filter_category_list_by_slug( 'regione', $categories );
$categories = filter_category_list_by_slug( 'lazio', $categories );
$categories = filter_category_list_by_slug( 'rm', $categories );