Human: How can I check a Python unicode string to see that it *actually* is proper Unicode? Assistant: 
Here is some code to check if string `foo` is UTF-8 encoded

foo.decode('utf8').encode('utf8')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.