The rule, which is similar to Rule 15 of the Federal Rules of Criminal Procedure, provides: If a defendant is in custody, the officer having custody ... shall, unless the defendant waives, in writing, the right to be present, produce him at the examination.... 17 A.R.S. Rules of Crim.