Apple interview question

To write a definition in python.