Habeas corpus refers to a writ requesting that a person or an institution that is detaining a named prisoner bring him or her before a judicial officer and give reasons for the priso ner's capture and detention so that the lawfulness of the imprisonment may be determined.