<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def split(inp_str, sep_char, maxsplit=-1, escape_char='\\'):
 """Separates a string on a character, taking into account escapes. :param str inp_str: string to split. :param str sep_char: separator character. :param int maxsplit: maximum number of times to split from left. :param str escape_char: escape character. :rtype: __generator[str] :return: sub-strings generator separated on the `sep_char`. """


    word_chars = []
    word_chars_append = word_chars.append

    inp_str_iter = iter(inp_str)

    for c in inp_str_iter:
        word_chars_append(c)
        if c == escape_char:
            try:
                next_char = next(inp_str_iter)
            except StopIteration:
                continue
            if next_char == sep_char:
                word_chars[-1] = next_char
            else:
                word_chars.append(next_char)
        elif c == sep_char:
            word_chars.pop()
            yield ''.join(word_chars)
            maxsplit -= 1
            if maxsplit == 0:
                yield ''.join(inp_str_iter)
                return
            del word_chars[:]

    yield ''.join(word_chars)