def split_by_unescaped_sep(text, sep=':'):
    """Split string at sep but only if not escaped."""
    def remerge(s):
        # s is a list of strings.
        for i in range(len(s) - 1):
            n_esc = len(s[i]) - len(s[i].rstrip('\\'))
            if n_esc % 2 == 0:
                continue
            else:
                new_s = s[:i] + [s[i] + sep + s[i + 1]] + s[i + 2:]
                return remerge(new_s)
        return s

    # split by every sep (even unescaped ones)
    # then re-merge strings that end in an uneven number of escape chars:
    return remerge(text.split(sep))