In all cases in which the law prescribes a single indivisible penalty, it shall be applied by the courts regardless of any mitigating or aggravating circumstances that may have attended the commission of the deed. In all cases in which the law prescribes a penalty composed of two indivisible penalties, the following rules shall be observed in the application thereof:
1. When in the commission of the deed there is present only one aggravating circumstance, the greater penalty shall be applied.
2. When there are neither mitigating nor aggravating circumstances and there is no aggravating circumstance, the lesser penalty shall be applied.
3. When the commission of the act is attended by some mitigating circumstances and there is no aggravating circumstance, the lesser penalty shall be applied.
4. When both mitigating and aggravating circumstances attended the commission of the act, the court shall reasonably allow them to offset one another in consideration of their number and importance, for the purpose of applying the penalty in accordance with the preceding rules, according to the result of such compensation.