A better get_declaring_class that doesn't require the attr object to be passed in.