If the person in custody is being held not by virtue of a court order, the custodian shall have the burden of proving the legality of the custody and of showing good cause why the person in custody should not be released.
If the person in custody is being held by virtue of a court order, he shall have the burden of proving the illegality of the custody and that he is entitled to be released.
La. Cr.P. § 365