A writ having for its object to bring a party before a
   court or judge; especially, one to inquire into the cause of a person's
   imprisonment or detention by another, with the view to protect the
   right to personal liberty; also, one to bring a prisoner into court to
   testify in a pending trial.