def convert_str_to_node_id(val): if isinstance(val, str) and val.startswith('NodeId_'): return NodeId._dencapsulate(val[7:]) return val