def insert_sections_many(ol,secs,locs,**kwargs):
if('<STR_LIT>' in kwargs):<EOL><INDENT>mode = kwargs["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>mode = "<STR_LIT>"<EOL><DEDENT>secs = copy.deepcopy(secs)<EOL>locs = copy.deepcopy(locs)<EOL>brked = broken_seqs(ol,locs)<EOL>seclen = secs.__len__()<EOL>brklen = brked.__len__()<EOL>if(locs[<NUM_LIT:0>]==<NUM_LIT:0>):<EOL><INDENT>new = secs[<NUM_LIT:0>]<EOL>length = seclen -<NUM_LIT:1><EOL>if(length < brklen):<EOL><INDENT>for i in range(<NUM_LIT:0>,length):<EOL><INDENT>new.extend(brked[i])<EOL>new.extend(secs[i+<NUM_LIT:1>])<EOL><DEDENT>for i in range(length,brklen):<EOL><INDENT>new.extend(brked[i])<EOL><DEDENT><DEDENT>elif(length == brklen):<EOL><INDENT>for i in range(<NUM_LIT:0>,length):<EOL><INDENT>new.extend(brked[i])<EOL>new.extend(secs[i+<NUM_LIT:1>])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for i in range(<NUM_LIT:0>,brklen):<EOL><INDENT>new.extend(brked[i])<EOL>new.extend(secs[i+<NUM_LIT:1>])<EOL><DEDENT>for i in range(brklen,length):<EOL><INDENT>new.extend(secs[i])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>new = brked[<NUM_LIT:0>]<EOL>length = brklen -<NUM_LIT:1><EOL>if(length < seclen):<EOL><INDENT>for i in range(<NUM_LIT:0>,length):<EOL><INDENT>new.extend(secs[i])<EOL>new.extend(brked[i+<NUM_LIT:1>])<EOL><DEDENT>for i in range(length,seclen):<EOL><INDENT>new.extend(secs[i])<EOL><DEDENT><DEDENT>elif(length == seclen):<EOL><INDENT>for i in range(<NUM_LIT:0>,length):<EOL><INDENT>new.extend(secs[i])<EOL>new.extend(brked[i+<NUM_LIT:1>])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for i in range(<NUM_LIT:0>,seclen):<EOL><INDENT>new.extend(secs[i])<EOL>new.extend(brked[i+<NUM_LIT:1>])<EOL><DEDENT>for i in range(seclen,length):<EOL><INDENT>new.extend(brked[i])<EOL><DEDENT><DEDENT><DEDENT>if(mode == "<STR_LIT>"):<EOL><INDENT>return(new)<EOL><DEDENT>else:<EOL><INDENT>ol.clear()<EOL>ol.extend(new)<EOL>return(ol)<EOL><DEDENT>
ol = initRange(0,20,1)
ol
locs = [1,6,14,9]
secs = [
    ['a','a','a'],
    ['b','b'],
    ['c','c','c','c'],
    ['d','d']
]
rslt = insert_sections_many(ol,secs,locs)
rslt
####
ol
locs = [0,3,6,9,12,15,16]
secs = [
    ['a','a','a'],
    ['b','b'],
    ['c','c','c','c'],
    ['d','d']
]
rslt = insert_sections_many(ol,secs,locs)
rslt
####
ol
locs = [1,6,14,9]
secs = [
    ['a','a','a'],
    ['b','b'],
    ['c','c','c','c'],
    ['d','d'],
    ['e'],
    ['f','f','f','f'],
    [777,777,777,777]
]
rslt = insert_sections_many(ol,secs,locs)
rslt