Avoid class name collision when using third party libraries in plugins?

I have had to do this before, and what I find the easiest for me to do is something like this:

    function check_for_library() {
        return class_exists( 'Class_Of_Library_In_Question' );
    }

Then you just fill in the right details and make a call to this function.

    if( ! check_for_library() ) {
        include_once( 'library_file.php' );
    }