def filter_input(input_string, match=None, unmatch=None):
    """Filter input_string on a per-line basis

    :param input_string: the input string to be filtered
    :param match: a string required in one line
    :param unmatch: a string should not exist in one line
    """
    ret = []
    for line in input_string.split('\n'):
        if (match is None or match in line) and (unmatch is None or unmatch
             not in line):
            ret.append(line)
    return '\n'.join(ret)
