import re


def escaped_split(inp_str, split_char):
    """
    Split inp_str on character split_char but ignore if escaped.
    Since, return value is used to write back to the intermediate
    data file, any escape characters in the input are retained in the
    output.

    :param inp_str: String to split
    :param split_char: Split character
    :return: List of splits
    """
    if len(split_char) > 1:
        raise ValueError('Expected split character. Found string!')
    out = re.sub(r'(\\.)|' + split_char,
                 lambda m: m.group(1) or '\n', inp_str,
                 len(inp_str)).split('\n')
    out = [x for x in out if x]
    return out