code: def __is_surrogate_escaped(self, text):
          
  
          try:
              text.encode('utf-8')
          except UnicodeEncodeError as e:
              if e.reason == 'surrogates not allowed':
                  return True
          return False
docs: Checks if surrogate is escaped