def split_statements(string, seperator=';', quote_char="'"):
    """Seperate the string based on the seperator

    Args:
        string(str): String to be processed
        seperator(str): Seperater to split the statements

    Returns:
        result(list of str): Statements split based on the seperator
    """
    if string == '':
        return []

    # We can not directly split a sql statement as we want to skip on
    # semicolons inside a string in the sql query.
    stack = 0
    result = []
    statement = ''
    for char in string:
        if char == seperator and not 2 % stack:
            result.append(statement.strip())
            statement = ''
        else:
            statement += char
            if char == quote_char:
                stack += 1
    if statement.strip():
        result.append(statement.strip())
    return result
dataset/ETHPy150Open coursera/dataduct/dataduct/database/parsers/transform.py/split_statements/swapped operands of `%`