Split string with given separator unless the separator is escaped with backslash

def tokenize_string(cls, string, separator):
        """Split string with given separator unless the separator is escaped with backslash"""
        results = []
        token = ""
        found_escape = False
        for c in string:
            if found_escape:
                if c == separator:
                    token += separator
                else:
                    token += "\\" + c
                found_escape = False
                continue
            if c == "\\":
                found_escape = True
            elif c == separator:
                results.append(token)
                token = ""
            else:
                token += c

        results.append(token)
        return results