def _flatten(v, val):
    """Recursively flatten vectorized var => {0, 1} mappings."""
    if isinstance(v, Variable):
        yield v, int(val)
    else:
        if len(v) != len(val):
            raise ValueError("expected 1:1 mapping from Variable => {0, 1}")
        for _var, _val in zip(v, val):
            yield from _flatten(_var, _val)
def _flatten ( v , val ) : if isinstance ( v , Variable ) : yield v , int ( val ) else : if len ( v ) != len ( val ) : raise ValueError ( "expected 1:1 mapping from Variable => {0, 1}" ) for _var , _val in zip ( v , val ) : yield from _flatten ( _var , _val )
Recursively flatten vectorized var => {0, 1} mappings.