def safe_split(string, delimter, trim=True):
    """
    Split a string using a single-character delimter
    @params:
        `string`: the string
        `delimter`: the single-character delimter
        `trim`: whether to trim each part. Default: True
    @examples:
        ```python
        ret = split("'a,b',c", ",")
        # ret == ["'a,b'", "c"]
        # ',' inside quotes will be recognized.
        ```
    @returns:
        The list of substrings
    """
    ret = []
    special1 = ['(', ')', '[', ']', '{', '}']
    special2 = ["'", '"', '`']
    special3 = '\\'
    flags1 = [0, 0, 0]
    flags2 = [False, False, False]
    flags3 = False
    start = 0
    for i, char in enumerate(string):
        if char == special3:
            flags3 = not flags3
        elif not flags3:
            if char in special1:
                index = special1.index(char)
                if index % 2 == 0:
                    flags1[int(index / 2)] += 1
                else:
                    flags1[int(index / 2)] -= 1
            elif char in special2:
                index = special2.index(char)
                flags2[index] = not flags2[index]
            elif char == delimter and not any(flags1) and not any(flags2):
                rest = string[start:i]
                if trim:
                    rest = rest.strip()
                ret.append(rest)
                start = i + 1
        else:
            flags3 = False
    rest = string[start:]
    if trim:
        rest = rest.strip()
    ret.append(rest)
    return ret
