Read about functions. ( im not aggressive saying that)
Explain :
1. return statement is breaking loop. Here it breaks the function and executes once more itself(if moved any item).
2. it only return new loop ( self ) if found and moved item. So if it will not find any item then it wont loop itself.
Also the module there is just useless ( better to just execute function at label or something like that ), i used here Module to show how it works.