If any person makes preparation to do or omits to do anything which constitutes an offence punishable under any of the provisions of section 15 to section 25 (both inclusive) and from the circumstances of the case it may be reasonably inferred that he was determined to carry out his intention to commit the offence but had been prevented by circumstances independent of his will, he shall be punishable with rigorous imprisonment for a term which shall not be less than one-half of the minimum term (if any), but which may extend to one-half of the maximum term, of imprisonment with which he would have been punishable in the event of his having committed such offence, and also with fine which shall not be less than one-half of the minimum amount (if any), of fine with which he would have been punishable, but which may extend to one-half of the maximum amount of fine with which he would have ordinarily (that is to say in the absence of special reasons) been punishable, in the event aforesaid:
Provided that the court may, for reasons to be recorded in the judgment, impose a higher fine.