This is the default sample code for the level:
# These Munchkins are scared of the hero!
# Say something and they'll back off.
# However, once there are enough Munchkins, they will gang up and ambush! Be careful!
# Whenever you can, cleave to clear the mass of enemies.
# Use isReady to check if the hero can cleave, otherwise say something!
The comment in the loop says: "Use isReady to check if the hero can cleave, otherwise say something!"
Your code is:
enemy = hero.findNearestEnemy()
Which when read is: "Find the nearest enemy, say 'boo', if an enemy exists, check if cleave is ready."