human
How to work with surrogate pairs in Python?
assistant
Here is some code to print a emoji from a string `\\ud83d\\ude4f` having surrogate pairs

"""\\ud83d\\ude4f""".encode('utf-16', 'surrogatepass').decode('utf-16')

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