tgrep.py: refactor _tgrep_node_literal_value and add unicode() cast