How is the ICD turned off for surgery so that I don't get shocked?

There are two ways doctors turn off the shocking feature on an ICD. Either they use a fancy magnet over the ICD to temporarily disable it, or they reprogram it to briefly turn off the shocking function.