The court may assign counsel to an inmate of any institution for the reformation of juvenile offenders who is to be tried for an offence alleged to have been committed therein; and shall, upon application, order the superintendent or other officer of such institution to produce at the trial such inmates thereof as, in the opinion of the counsel for the defence, certified in writing, or of the judge, in the absence of counsel, are material witnesses for the defence; and such officer shall obey the order and provide for the custody and safe return of such inmates.
Mass. Gen. Laws ch. 278, § 16