I think you are referring to the str.encode("string-escape") method. Let's say you are having a variable that you want to convert to 'raw string':
a = '\x89'
One important piece of information that you can only use string-escape for python 2.x and older versions.
If you are a beginner and want to know more about Python, then do refer to the Python certification.