def test(lst1, lst2):
    length, i, item = len(lst1), 0, lst1[0]
for x in lst2:
    if x == item:
        i += 1
if i == length:
    return True
item = lst1[i]
return False
Comparing element order in Python lists