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

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

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=19,
        heading="Physical representation",
        description="The library {\\tt stringtools} shall have a method {\\tt physical\\_repr}, transforming a float or integer value to a string with a 1 to 3 digit value followed by the physical prefix for the unit.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=20,
        heading="Time representation",
        description="The library {\\tt stringtools} shall have a method {\\tt physical\\_repr}, transforming an integer value to a time string like {\\tt HH:MM:SS}.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=21,
        heading="Fraction representation",
        description="The library {\\tt stringtools} shall have a method {\\tt frac\\_repr}, transforming a float or integer value to a fraction string with a limited denominator.",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=2,
        heading="Human readable value representations",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=3,
        heading="Stream to Human readable String",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=1,
        heading="Hexadecimal Values",
        description="A Stream shall be converted to a human readable String containing all bytes as hexadecimal values seperated by a Space.",
        reason="Make non printable characters printable.",
        fitcriterion="A stream shall be converted at least once and the hex values shall exist in the returnvalue in the correct order.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=2,
        heading="Number of Bytes",
        description="The Length of a Stream surrounded by brakets shall be included in the human readable string.",
        reason="Show the length of a Stream without counting the seperated values.",
        fitcriterion="The described pattern including the decimal number of bytes is included in the string for at least one Stream.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=5,
        heading="CRLF-Filter",
        description="The module stringtools shall have a method to replace carriage return and line feed to their escaped representation.",
        reason="Replace these characters to make output printable (e.g. for logging a string based protocol).",
        fitcriterion="Filter at least one string and check at least one CR and one LF representation.",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=4,
        heading="Stream Compression",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=3,
        heading="Compress",
        description="The module stringtools shall have a method compressing a Stream with gzip.",
        reason="Speed up transfer with low transfer rate.",
        fitcriterion="Compressed Stream is extractable and results in the original data.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=4,
        heading="Extract",
        description="The module stringtools shall have a method extracting a Stream with gzip.",
        reason="Speed up transfer with low transfer rate.",
        fitcriterion="Extracted Stream is equal to the original compressed data.",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=5,
        heading="Carriagereturn Seperation Protocol (CSP)",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=6,
        heading="Frame creation",
        description="The CSP module shall support a method to create a Frame from a stream.",
        reason="Simple message or frame generation for streams (e.g. Keyboard (user input), RFID-Reader, \\ldots).",
        fitcriterion="Creation of a testframe and checking the result.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=7,
        heading="Frame creation error",
        description="The Frame creation Method shall raise ValueError, if a frame separation character is in the Source-String.",
        reason="String including separation charcter will be splitted in pieces while processing after transport.",
        fitcriterion="ValueErroro is raised for at least one String including the separation character.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=8,
        heading="Frame processing",
        description="The CSP Module shall support a class including a method to process stream snipets of variable length. This Method shall return an empty list, if no frame has been detected, otherwise it shall return a list including detected frame(s).",
        reason="Support message analysis of a stream with every size.",
        fitcriterion="At least one frame given in at least two snippets is identified correctly.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=9,
        heading="Frame processing - Input data type error",
        description="If the input data is not bytes for python3 or str for python 2, the process method shall raise TypeError.",
        reason="Type restriction.",
        fitcriterion="At least the following types return TypeError (list, int, str for python3, unicode for python 2).",
    )
    #
    # Section
    #
    sec_uuid = req_spec.add(
        itemtype="SEC",
        id=6,
        heading="Serial Transfer Protocol (STP)",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=10,
        heading="Frame creation",
        description="A frame creation method shall create a frame out of given input data.",
        reason="Message or Frame generation for streams (e.g. data transfer via bluetooth, ethernet, \\ldots).",
        fitcriterion="Creation of a testframe and checking the result.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=15,
        heading="Frame creation - Start pattern and end pattern inside a message",
        description="The frame creation method shall support existance of the start or end pattern in the data to be framed.",
        reason="Possibility to send any kind of data (including the patterns).",
        fitcriterion="Creation of a testframe out of data including at least one start pattern and one end pattern and checking the result.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=11,
        heading="Frame processing",
        description="The STP Module shall support a class including a method to process stream snipets of variable length. This Method shall return an empty list, if no frame has been detected, otherwise it shall return a list including detected frame(s).",
        reason="Support message analysis of a stream with every size.",
        fitcriterion="At least one frame given in at least two snippets is identified correctly.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=12,
        heading="Frame processing - Input data type error",
        description="If the input data is not bytes for python3 or str for python 2, the process method shall raise TypeError.",
        reason="Type restriction.",
        fitcriterion="At least the following types return TypeError (list, int, str for python3, unicode for python 2).",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=13,
        heading="Frame processing - Start pattern and end pattern inside a message",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=14,
        heading="Frame processing - Data before the start pattern",
        description="Data before the start pattern shall be ignored. A warning shall be given to the logger.",
        reason="Robustness against wrong or corrupted data.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=16,
        heading="Frame processing - Incorrect start patterns",
        description="On receiving an incorrect start pattern, STP shall stay in ESCAPE\\_1, in case of data sync was received twice or back to state IDLE in all other faulty start patterns starting with data sync. A warning shall be given to the logger.",
        reason="Robustness against wrong or corrupted data.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=17,
        heading="Frame processing - Incorrect end pattern",
        description="On receiving an incorrect end pattern, STP shall change to state STORE\\_DATA, in case of a start pattern, to ESCAPE\\_1, in case of data sync was received twice or back to state IDLE in all other faulty end patterns starting with data sync. A warning shall be given to the logger.",
        reason="Robustness against wrong or corrupted data.",
    )

    # Requirement
    req_spec.add(
        parent=sec_uuid,
        itemtype="REQ",
        id=18,
        heading="Frame processing - After state corruption",
        description="The state of STP shall be set to IDLE, after an unknown state was recognised. The currently processed data shall be processed again. An error shall be given to the logger.",
        reason="Robustness against wrong or corrupted data.",
    )
