The following function (taken from this SO question) works fine as long as number of rotations does not exceed the number of elements in list. After that it just repeats the original list. Is there any modification that can be done to rotate a list any number of times?
def shift(l,n):
return l[n:] + l[:n]