If any officer or seaman or apprentice who is not shipped in Pakistan is imprisoned for any offence for which he has been sentenced to imprisonment for a term not exceeding on month and his services are required on board his ship during his imprisonment but before the expiration of the period of his engagement, any magistrate may, on the applica...