def is_shifted_copy(l1, l2):
    l1l1 = l1 * 2
n = len(l1)
return next((i for i in range(n) if l1l1[i:i + n] == l2), None)
In Python, efficiently determine if two lists are shifted copies of one another