Except as otherwise provided in section 8.511 of this Charter, no person retired as a member under Section 8.559 for service or disability and entitled to receive a retirement allowance under the Retirement System shall serve in any elective or appointive position in the City and County service, including membership on boards and commissions, nor shall such person receive any payment for service rendered to the City and County after retirement, provided that service as an election officer or juror, or in the preparation for, or the giving of, testimony as an expert witness for or on behalf of the City and County of San Francisco before any court or legislative body shall not be affected by this section.