How to modify get_the_excerpt() when post-format equals ‘quote’?

While writing the question in SE I already found the solution:

add_filter( 'get_the_excerpt', 'get_custom_the_excerpt' );

function get_custom_the_excerpt($excerpt) {

    $post = get_post();
    $format = get_post_format( $post );

    // modify excerpt if it is a quote, for example set title as author 
    if ($format == 'quote') {
        $output="<q>". $excerpt. '</q>
                <p class="quoted">'.get_the_title().'</p>';
    } 

    // return excerpt without change
    else {
        $output = $excerpt;
    }

    return $output;

}

For details check get_the_excerpt() and get_post_format().