def filter_errors(seq, errors):
    """Helper for filter_keys.
    Return singleton list of error term if only errors are in sequence; else
    return all non-error items in sequence.
    Args
        seq: list of strings
        errors: dict representing error values
    Returns
        List of filtered items.
    """
    key_err, val_err = errors['key'], errors['val']
    key_err_str, val_err_str = errors['key_str'], errors['val_str']

    return ([key_err_str] if set(seq) == set([key_err]) else
            [val_err_str] if set(seq) == set([val_err]) else
            [s for s in seq if s not in (key_err, val_err)])