A petition for a state writ of habeas corpus can be used to challenge a criminal conviction and/or sentence for a state crime in California, or to challenge the conditions under which a prisoner is serving his or her sentence.