A discovery motion under Penal Code section 1054.9 may be denied when the motion is filed to discover matters relevant to the prosecution of a writ on grounds already litigated and decided against the petitioner in a prior habeas. Petitioner Baca filed a habeas petition in state court and federal court, both writs alleging IAC for failure to present expert testimony on lack of intent to kill, and both of which were denied. Baca then filed two post-conviction discovery motions under Penal Code section 1054.9, which requires defendants sentenced to death or to LWOP to be given post-conviction discovery that would have been subject to disclosure at trial. This writ of mandate followed the denial of the second discovery motion. The appellate court held it was not an abuse of discretion to deny the motion. The statute was enacted for the purpose of prosecuting a writ of habeas corpus. But, petitioner would be procedurally barred from filing a habeas petition based on the evidence he sought, any evidence negating his intent to kill, because it would be a successive habeas petition. Thus, for purposes of the statute, the discovery motion was not filed “upon the prosecution of a post-conviction writ of habeas corpus.” As such, it was properly denied.