def all(sequence, test_func = None):
    """
    Returns 1 if for all members of a sequence, test_func returns a non-zero
    result. If test_func is not supplied, returns 1 if all members of the
    sequence are nonzero (i.e., not one of (), [], None, 0).
    """
    for item in sequence:
        if test_func:
            if not test_func(item):
                return 0
        elif not item:
            return 0
    return 1