def rotate_r(L, k):
 ll = list(L)
 if (ll == []):
  return []
 for i in range(k):
  el = ll.pop((len(ll) - 1))
  ll.insert(0, el)
 return (ll if (type(L) is list) else Matrix([ll]))

def rotate_r ( L , k ) : ll = list ( L ) if ( ll == [ ] ) : return [ ] for i in range ( k ) : el = ll . pop ( ( len ( ll ) - 1 ) ) ll . insert ( 0 , el ) return ( ll if ( type ( L ) is list ) else Matrix ( [ ll ] ) )
rotates right by k .