def split_at_single(text, sep, not_before=[], not_after=[]):
n = <NUM_LIT:0><EOL>lt, s = len(text), len(sep)<EOL>last = <NUM_LIT:0><EOL>while n < lt:<EOL><INDENT>if not s + n > lt:<EOL><INDENT>if sep == text[n:n + s]:<EOL><INDENT>if any(text[last:n].endswith(e) for e in not_before):<EOL><INDENT>pass<EOL><DEDENT>elif any(text[n + s:].startswith(e) for e in not_after):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>yield text[last:n]<EOL>last = n + s<EOL>n += s - <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>n += <NUM_LIT:1><EOL><DEDENT>yield text[last:]<EOL>
Works like text.split(sep) but separated fragments
    cant end with not_before or start with not_after