Posting this macro for myself..but it should be similar to what Sev was showing you Gab.
Puts you in Defensive Stance if you aren’t in it already, then checks to see if the target is friendly and if so casts Intervene. If you are targeting a mob, then it targets the target (your teammate) and casts Intervene.
/cast [nostance:2] Defensive Stance; [help] Intervene; [target=targettarget, help] Intervene