Helper function that checks if a node has a supplied class