What Moonwatcher said. Comment out your code twice. Then here are some things I noticed.
enemyIndex = 0
if enemy.type == 'shaman': #At this point in the code, enemy is not defined. You'll need to define it. Maybe a for-loop or a while-loop.
enemies = hero.findEnemies() #enemies isn't used in this conditional. You don't need this line.
while enemy.health > 0: #Again, enemy is not defined.
hero.attack(enemy) #Same enemy thing
enemyIndex += 1
#Actually, this whole part of this code is a duplicate of below.
enemies = hero.findEnemies()
enemyIndex = 0 #enemyIndex is already defined. You normally want to stay away from defining things twice.
while enemyIndex < len(enemies):
#you need to add an enemy variable here (enemy = enemies[enemyIndex]).
if enemy.type == 'shaman':
while enemy.health > 0:
hero.attack(enemy)
enemyindex = enemyindex + 1