def get_scell_state(scell, verbose=False):
    """Returns the state for a structured cell.

    Result:

    auth_joining:   An auth task is ongoing
    joining:   A join or auth task is ongoing
    void :     The structured cell and all outchannels must be voided
    pending:   Waiting for pending inchannels
               Everything must be unvoided, including scell value and exception
    devalued-: A join has happened earlier
               The scell is currently non-void.
               Some inchannels have been devalued (voided) since the last join
               A new join is needed.
               In the meantime, unvoid everything, including cell value and exception
    devalued+: A join has happened earlier.
               The scell is currently void, because of a schema exception.
               Some inchannels have been devalued (voided) since the last join
               A join is needed (where the schema might then unvoid the scell).
               In the meantime, unvoid everything, including scell value and exception
    equilibrium: nothing will change.
               The structured cell is not void. Some inchannels and outchannels are void, others not.
    join:      There are valid inchannels and/or an auth value.
               There are no pending inchannels or auth modifications, but no value has yet been set.
               (Or, the value was unset by a modified schema)
               Launch a join.
    """
    auth_joining = scell._auth_joining
    joining = scell._joining
    modified_auth = scell._modified_auth
    auth_invalid = scell._auth_invalid
    pending_inchannels = {k for k,ic in scell.inchannels.items() if (ic._checksum is None and not ic._void)}
    valid_inchannels = {k for k,ic in scell.inchannels.items() if not ic._void}
    devalued_inchannels = {k for k,ic in scell.inchannels.items() if (ic._void and ic._last_state[1] is not None)}
    has_auth = scell.auth is not None and scell.auth._checksum is not None
    has_exc = scell._exception is not None and not auth_invalid

    if auth_joining:
        result = "auth_joining"
    elif modified_auth:
        result = "pending"
    elif auth_invalid:
        result = "void"
    elif len(pending_inchannels):
        result = "pending"
    elif joining:
        result = "joining"
    elif not has_auth and not len(valid_inchannels):
        result = "void"
    else:
        if len(scell.inchannels):
            if has_exc:
                if len(devalued_inchannels):
                    result = "devalued+"
                else:
                    result = "void"
            else:
                if scell._data._checksum is None:
                    result = "join"
                else:
                    if len(devalued_inchannels):
                        result = "devalued-"
                    else:
                        result = "equilibrium"
        else: # implies has_auth
            if has_exc:
                result = "void"
            else:
                if scell._data._checksum is None:
                    result = "join"
                else:
                    result = "equilibrium"

    if verbose:
        print("STATE", scell, result, modified_auth, auth_invalid, pending_inchannels, valid_inchannels, devalued_inchannels, has_auth, has_exc)

    return result