The Agrippa Defense (need help)

I’ve been trying to figure this out for a while now because I only kill the first two groups and not the second please help.
Here is my code:

loop:
enemy = self.findNearestEnemy()

if enemy:
    a = self.distanceTo(enemy)
    if a < 5: 
        self.isReady("cleave")
        self.cleave(enemy)
    else:
            self.attack(enemy)

You must test if your cleave is ready:

if self.isReady("cleave"):
    self.cleave(enemy)

Oh, Thanks that helped.