(stuple)
return result
Construct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict.
Construct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict.
Construct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict .
def _list_from_statespec(stuple):
    """Construct a list from the given statespec tuple according to the
    accepted statespec accepted by _format_mapdict."""
    if isinstance(stuple, str):
        return stuple
    result = []
    it = iter(stuple)
    for state, val in zip(it, it):
        if hasattr(state, 'typename'):  # this is a Tcl object
            state = str(state).split()
        elif isinstance(state, str):
            state = state.split()
        elif not isinstance(state, (tuple, list)):
            state = (state,)
        if hasattr(val, 'typename'):
            val = str(val)
        result.append((*state, val))

    return result
def _list_from_statespec ( stuple ) : if isinstance ( stuple , str ) : return stuple result = [ ] it = iter ( stuple ) for state , val in zip ( it , it ) : if hasattr ( state , 'typename' ) : # this is a Tcl object state = str ( state ) . split ( ) elif isinstance ( state , str ) : state = state . split ( ) elif not isinstance ( state , ( tuple , list ) ) : state = ( state , ) if hasattr ( val , 'typename' ) : val = str ( val ) result . append ( ( * state , val ) ) return result