A small battery-operated electronic device that is surgically implanted under the skin and joined to the heart by wires, and that measures the pulse and corrects too fast or too slow heart rhythms.
Source: GreenFacts
An ICD [implantable cardiac defibrillator] is a pacemaker-like device implanted under the skin. Wires called "leads" are placed in the heart to monitor the heart rate. When the device detects a potentially deadly heart rhythm disorder (arrhythmia), the ICD delivers a controlled, electric shock to restore the heart's normal rhythm.
Source: Heart Rhythm Society Heart
Attack
Arrhythmia - Circulatory system - Ventricular fibrillation