def insert_l(l, v, old_index, type='append'):
r = []
# p<len(l)
nl = len(l)
for i in range(nl):
if type == 'append':
r.append(l[i])
if i == old_index:
r.append(v)
elif type == 'before':
if i == old_index:
r.append(v)
r.append(l[i])
def insert_l(l, v, old_index, type='append'):
r = []
# p<len(l)
nl = len(l)
for i in range(nl):
if type == 'append':
r.append(l[i])
if i == old_index:
r.append(v)
elif type == 'before':
if i == old_index:
r.append(v)
r.append(l[i])