def _modify_new_lines(code_to_modify, all_inserted_code):
    """
    Generate a new bytecode instruction to line number mapping aka ``lnotab`` after injecting the debugger specific code.
    Note, that the bytecode inserted should be the last instruction of the line preceding a line with the breakpoint.

    :param code_to_modify: the original code in which we injected new instructions.
    :type code_to_modify: :py:class:`types.CodeType`

    :param all_inserted_code: a list of modifications done. Each modification is given as a named tuple with
      the first field ``offset`` which is the instruction offset and ``code_list`` which is the list of instructions
      have been injected.
    :type all_inserted_code: list

    :return: bytes sequence of code with updated lines offsets which can be passed as the ``lnotab`` parameter of the
      :py:class:`types.CodeType` constructor.
    """
    if code_to_modify.co_firstlineno == 1 and len(all_inserted_code
        ) > 0 and all_inserted_code[0
        ].offset == 0 and code_to_modify.co_name == '<module>':
        return None
    new_list = list(code_to_modify.co_lnotab)
    if not new_list:
        return None
    byte_increments = code_to_modify.co_lnotab[0::2]
    line_increments = code_to_modify.co_lnotab[1::2]
    all_inserted_code = sorted(all_inserted_code, key=lambda x: x.offset)
    addr = 0
    it = zip(byte_increments, line_increments)
    k = inserted_so_far = 0
    for i, (byte_incr, _line_incr) in enumerate(it):
        addr += byte_incr
        if addr == all_inserted_code[k].offset - inserted_so_far:
            bytecode_delta = len(all_inserted_code[k].code_list)
            inserted_so_far += bytecode_delta
            new_list[i * 2] += bytecode_delta
            k += 1
            if k >= len(all_inserted_code):
                break
    return bytes(new_list)
