A former Australian police officer has avoided a prison term for killing a 95-year-old nursing home resident with a stun gun.