Templating. Check if entity is comment or node? I'm modifying a template file for an Advanced Forum sub theme. AF uses a single template to theme both nodes AND comments with the same markup. I need to add a php check inside the node template to see if the current entity is a node or a comment, then print some flags based on the result. 

I don't think there is a straight forward $entity_type variable to check, so how would I go about writing this?
Assuming this is for Drupal 7, there isn't an official way to do this, unfortunately. See core issue: https://www.drupal.org/node/1042822

One possible workaround is to check if the entity has some known fields that you are aware of. This obviously wouldn't be a generalized solution - but might work for you.