(expr, assumptions, key)
Test for membership in a group with respect
    to the current operation
Test for membership in a group with respect
    to the current operation
Test for membership in a group with respect to the current operation
def test_closed_group(expr, assumptions, key):
    """
    Test for membership in a group with respect
    to the current operation
    """
    result = True
    for arg in expr.args:
        _out = ask(key(arg), assumptions)
        if _out is None:
            break
        elif _out is False:
            if result:
                result = False
            else:
                break
    else:
        return result
def test_closed_group ( expr , assumptions , key ) : result = True for arg in expr . args : _out = ask ( key ( arg ) , assumptions ) if _out is None : break elif _out is False : if result : result = False else : break else : return result