def specification(req_spec):
    req_spec.add_title("Module state_machine")

    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=1,
        heading="Module Initialisation",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=5,
        heading="Default State",
        description="The state machine shall start in the state, given while module initialisation.",
        reason="Creation of a defined state after initialisation.",
        fitcriterion="State machine is in the initial state after initialisation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=6,
        heading="Default Last Transition Condtion",
        description="The state machine shall return the string {\\tt \\_\\_init\\_\\_} for last transition condition after initalisation.",
        reason="Creation of a defined state after initialisation.",
        fitcriterion="The last transition condition is {\\tt \\_\\_init\\_\\_} after initialisation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=7,
        heading="Default Previous State",
        description="The state machine shall return {\\tt None} for previous state after initalisation.",
        reason="Creation of a defined state after initialisation.",
        fitcriterion="The previous state is {\\tt None} after initialisation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=8,
        heading="Additional Keyword Arguments",
        description="The state machine shall store all given keyword arguments as variables of the classes instance.",
        reason="Store further information (e.g. for calculation of the transition conditions).",
        fitcriterion="At least two given keyword arguments with different types are available after initialisation.",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=2,
        heading="Transition Changes",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=17,
        heading="Transitiondefinition and -flow",
        description="The user shall be able to define multiple states and transitions for the state machine. A transition shall have a start state, a target state and a transition condition. The transition condition shall be a method, where the user is able to calculate the condition on demand.",
        reason="Definition of the transitions for a state machine.",
        fitcriterion="The order of at least three state changes is correct.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=18,
        heading="Transitiontiming",
        description="The user shall be able to define for each transition a transition time. On change of the transition condition to {\\tt True}, the transition timer starts counting the time from 0.0s. After reaching the transition time, the transition gets active.",
        reason="Robustness of the state changes (e.g. Oscillating conditions shall be ignored).",
        fitcriterion="The transition time and the restart of the transion timer by setting the transition condition to {\\tt False} and to {\\tt True} again results in the expected transition timing ($\\pm$0.05s).",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=19,
        heading="Transitionpriorisation",
        description="The state machine shall use the first active transition. If multiple transition are active, the transition with the highest overlap time will be used.",
        reason="Compensate the weakness of the execution quantisation.",
        fitcriterion="At least one transition with at least two active conditions results in the expected state change.",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=3,
        heading="Module Interface",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=9,
        heading="This State",
        description="The Module shall have a method for getting the current state.",
        reason="Comfortable user interface.",
        fitcriterion="At least one returend state fits to the expecation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=10,
        heading="This State is",
        description="The Module shall have a method for checking if the given state is currently active.",
        reason="Comfortable user interface.",
        fitcriterion="At least two calls with different return values fit to the expectation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=11,
        heading="This State Duration",
        description="The Module shall have a method for getting the time since the last state change appears.",
        reason="Comfortable user interface.",
        fitcriterion="At least one returned duration fits to the current state duration ($\\pm$ 0.05s).",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=12,
        heading="Last Transition Condition",
        description="The Module shall have a method for getting the last transition condition.",
        reason="Comfortable user interface.",
        fitcriterion="At least one returned transition condition fits to the expectation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=13,
        heading="Last Transition Condition was",
        description="The Module shall have a method for checking if the given condition was the last transition condition.",
        reason="Comfortable user interface.",
        fitcriterion="At least two calls with different return values fit to the expectation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=14,
        heading="Previous State",
        description="The Module shall have a method for getting the previous state.",
        reason="Comfortable user interface.",
        fitcriterion="At least one returend state fits to the expecation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=15,
        heading="Previous State was",
        description="The Module shall have a method for checking if the given state was the previous state.",
        reason="Comfortable user interface.",
        fitcriterion="At least two calls with different return values fit to the expectation.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=16,
        heading="Previous State Duration",
        description="The Module shall have a method for getting active time for the previous state.",
        reason="Comfortable user interface.",
        fitcriterion="At least one returned duration fits to the previous state duration ($\\pm$ 0.05s).",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=4,
        heading="Transition Callbacks",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=1,
        heading="State change callback for a defined transition and targetstate",
        description="The state machine shall call all registered methods in the same order like the registration with all user given arguments for a defined set of \\emph{transition\\_condition} and \\emph{target\\_state}.",
        reason="Triggering state change actions for a specific transition condition and targetstate.",
        fitcriterion="Methods are called in the registration order after state change with all user given arguments for the defined transition condition and targetstate and at least for one other condition not.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=2,
        heading="State change callback for a defined transition",
        description="The state machine shall call all registered methods in the same order like the registration with all user given arguments for a defined \\emph{transition\\_condition} and all \\emph{target\\_states}.",
        reason="Triggering state change actions for a specific transition condition.",
        fitcriterion="Methods are called in the registration order after state change with all user given arguments for the defined transition condition and at least for one other transition condition not.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=3,
        heading="State change callback for a defined targetstate",
        description="The state machine shall call all registered methods in the same order like the registration with all user given arguments for all \\emph{transition\\_conditions} and a defined \\emph{target\\_state}.",
        reason="Triggering state change actions for a specific targetstate.",
        fitcriterion="Methods are called in the registration order after state change with the defined targetstate and at least for one other targetstate not.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=4,
        heading="State change callback for all kind of state changes",
        description="The state machine shall call all registered methods in the same order like the registration with all user given arguments for all transitions.",
        reason="Triggering state change actions for all transition conditions and targetstates.",
        fitcriterion="Methods are called in the registration order after state change.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=20,
        heading="Execution order of Callbacks",
        description="The callbacks shall be executed in the same order as they had been registered.",
        reason="User shall have the control about the execution order.",
        fitcriterion="A callback with specific targetstate and condition will be executed before a non specific callback if the specific one had been regestered first.",
    )
