def _exception_predicate(etype, target, exclude, strict):
    """Determine whether to trim traceback of certain exception."""
    if not isinstance(target, tuple):
        target = target,
    if not isinstance(exclude, tuple):
        exclude = exclude,
    if strict:
        target_flag = any(map(lambda e: etype is e, target))
        except_flag = all(map(lambda e: etype is not e, exclude))
    else:
        target_flag = any(map(lambda e: issubclass(etype, e), target))
        except_flag = all(map(lambda e: not issubclass(etype, e), exclude))
    return target_flag and except_flag
