def constructFiniteStateMachine(inputs, outputs, states, table, initial,
                                richInputs, inputContext, world,
                                logger=LOGGER):
    table = table.table

    _missingExtraCheck(
        set(table.keys()), set(states.iterconstants()),
        ExtraTransitionState, MissingTransitionState)

    _missingExtraCheck(
        set(i for s in table.values() for i in s), set(inputs.iterconstants()),
        ExtraTransitionInput, MissingTransitionInput)

    _missingExtraCheck(
        set(output for s in table.values() for transition in s.values() for output in transition.output),
        set(outputs.iterconstants()),
        ExtraTransitionOutput, MissingTransitionOutput)

    try:
        _missingExtraCheck(
            set(transition.nextState for s in table.values() for transition in s.values()),
            set(states.iterconstants()),
            ExtraTransitionNextState, MissingTransitionNextState)
    except MissingTransitionNextState as e:
        if e.args != ({initial},):
            raise

    if initial not in states.iterconstants():
        raise InvalidInitialState(initial)

    extraInputContext = set(inputContext) - set(outputs.iterconstants())
    if extraInputContext:
        raise ExtraInputContext(extraInputContext)

    _checkConsistency(richInputs, table, inputContext)

    fsm = _FiniteStateMachine(inputs, outputs, states, table, initial)
    executor = IOutputExecutor(world)
    interpreter = _FiniteStateInterpreter(
        tuple(richInputs), inputContext, fsm, executor)
    if logger is not None:
        interpreter = FiniteStateLogger(
            interpreter, logger, executor.identifier())
    return interpreter
:type next_token: string
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/constructFiniteStateMachine--crossover with--dataset/ETHPy150Open darcyliu/storyboard/boto/sns/connection.py/SNSConnection.get_all_topics