Python ascii() built-in function
From the Python 3 documentation
As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \x, \u, or \U escapes.
Examples
>>> ascii('A')
# 'A'
>>> ascii('ë')
# '\xeb'
>>> ascii(['A', 'ë'])
# ['A', '\xeb']