if is specific custom post in cpt

I don’t think that is possible using some function (I can be completely wrong though).
What you can do is check page slug using if() statement.
Something like:

global $post;
$post_slug=$post->post_name;
if($post_slug=='harry-potter'){
    //something here
}

tech