How to fix ValueError: malformed node or string in Python | DevErrors