Checks if surrogate is escaped

def __is_surrogate_escaped(self, text):
        """ Checks if surrogate is escaped
        """

        try:
            text.encode('utf-8')
        except UnicodeEncodeError as e:
            if e.reason == 'surrogates not allowed':
                return True
        return False