in pseudocode, it would work like this

Code:
 1. target current hunter's pet
 2. if the current target (pet) is out, but dead as a corpse, cast Revive Pet
 3. target the target of focus
 4. start normal attack
 5. send pet in to attack
 6. start Auto Shot
yes, !Auto Shot means it would not constantly toggle on and off.

and no, it would not flash because the system is intelligent enough to look ahead on what's planned, consider this

Code:
 /target Huntard
 /cast Lesser Healing Wave
 /cleartarget
now this would not even bring the portrait of Huntrad visible, the only thing you would see after using this macro is that you begin casting Lesseer Healing Wave and you have no target currently selected

so in essence that would work, toggle between pet and assist focus

that is, there's no CAST THIS IF PET IS DEAD as far as I know.a