First, a U.S.C. § 2254 allows us to file a petition for Habeas Corpus when the client is in custody under sentence of a state court and is in a state prison. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court.Category Representing Yourself (Pro Se). Petition for a Writ of Habeas Corpus under 28 USC 2241. In order to raise an issue in a federal habeas petition, the issue must be raised and exhausted in state court. Hence, the filing of this petition. An existing custody order for a parent to seek a writ of habeas corpus or for Family Court to award custody to either parent in the proceeding. It demands a person's release from unlawful detention. In this petition, you must explain why you believe you are being unlawfully detained and provide evidence to support your claim. The petition may be filed in the superior court, the court of appeal having jurisdiction over the case or the Supreme Court of the State of California.