(1) if the custody or confinement is by virtue of an arrest on a charge of felony, or conviction of any offense, be fined not more than $2,000 or imprisoned not more than 10 years, or both; or
(2) if the custody or confinement is for extradition or by virtue of an arrest or charge of or for a misdemeanor, and prior to conviction therefor, be fined not more than $500 or imprisoned not more than 1 year, or both.