I believe get_node() returns a node, which is not a boolean, so it cant be true or false. What you might want to do is wether the node is found, you can check it like this:
if key == null:
#node isnt found
else:
#node found
I’d like to add you should not use get_node on an optional node. The reason is, get_node will produce an error if the node isn’t found, and it can confuse you down the road because such error could be a mistake in your code, it’s harder to find them if you have to “ignore errors that are actually fine”.
For optional nodes, use has_node instead, then if it succeeds, use get_node if you need the node.