1054.9.
(a) In a case in which a defendant is or has ever been convicted of a serious felony or a violent felony resulting in a sentence of 15 years or more, upon the prosecution of a postconviction writ of habeas corpus or a motion to vacate a judgment, or in preparation to file that writ or motion, and on a showing that good faith efforts to obtain discovery materials from trial counsel were made and were unsuccessful, the court shall, except as provided in subdivision (b) or (d), order that the defendant be provided reasonable access to any of the materials described in subdivision (c).(b) Notwithstanding subdivision (a), in a case in which a sentence other than death or life in prison without the possibility of parole is or has ever been imposed, if a court has entered a previous order granting discovery pursuant to this section, a subsequent order granting discovery pursuant to subdivision (a) may be made in the court’s discretion. A request for discovery subject to this subdivision shall include a statement by the person requesting discovery as to whether that person has previously been granted an order for discovery pursuant to this section.
(c) For purposes of this section, “discovery materials” means materials in the possession of the prosecution and law enforcement authorities to which the same defendant would have been entitled at time of trial.
(d) In response to a writ or motion satisfying the conditions in subdivision (a), the court may order that the defendant be provided access to physical evidence for the purpose of examination, including, but not limited to, any physical evidence relating to the investigation, arrest, and prosecution of the defendant only upon a showing that there is good cause to believe that access to physical evidence is reasonably necessary to the defendant’s effort to obtain relief. The procedures for obtaining access to physical evidence for purposes of postconviction DNA testing are provided in Section 1405, and this section does not provide an alternative means of access to physical evidence for those purposes.
(e) The actual costs of examination or copying pursuant to this section shall be borne or reimbursed by the defendant.
(f) This section does not require the retention of any discovery materials not otherwise required by law or court order.
(g) In criminal matters involving a conviction for a serious or a violent felony resulting in a sentence of 15 years or more, trial counsel shall retain a copy of a former client’s files for the term of that client’s imprisonment. An electronic copy is sufficient only if every item in the file is digitally copied and preserved.
(h) As used in this section, a “serious felony” is a conviction of a felony enumerated in subdivision (c) of Section 1192.7.
(i) As used in this section, a “violent felony” is a conviction of a felony enumerated in subdivision (c) of Section 667.5.
(j) Subdivision (g) only applies prospectively, commencing January 1, 2019.