def append_seq_markers(data, seq_begin=True, seq_end=True):
    """
    `data` is a list of sequences. Each sequence is a list of numbers. For
    example, the following could be an example of data:

    [[1, 10, 4, 1, 6],
     [1, 2,  5, 1, 3],
     [1, 8,  4, 1, 2]]

    Assume that 0 and 11 are IDs corresponding to 'SEQ_BEGIN' and 'SEQ_END',
    respectively. This function adds 'SEQ_BEGIN' and 'SEQ_END' to all lists,
    depending on the values of `seq_begin` and `seq_end`. For example, if
    both are true, then, for the input above, this function will return:

    [[0, 1, 10, 4, 1, 6, 11],
     [0, 1, 2,  5, 1, 3, 11],
     [0, 1, 8,  4, 1, 2, 11]]

    Keyword arguments:
    seq_begin -- If True, add the ID corresponding to 'SEQ_BEGIN' to each sequence
    seq_end   -- If True, add the ID corresponding to 'SEQ_END' to each sequence
    """
    data_ = []
    for d in data:
        if seq_begin:
            d = ['SEQ_BEGIN'] + d
        if seq_end:
            d = d + ['SEQ_END']
        data_.append(d)
    return data_