In cases in which the penalties prescribed by law contain three periods, whether it be a single divisible penalty or composed of three different penalties, each one of which forms a period in accordance with the provisions of Articles 76 and 77, the court shall observe for the application of the penalty the following rules, according to whether there are or are not mitigating or aggravating circumstances:
1. When there are neither aggravating nor mitigating circumstances, they shall impose the penalty prescribed by law in its medium period.
2. When only a mitigating circumstances is present in the commission of the act, they shall impose the penalty in its minimum period.
3. When an aggravating circumstance is present in the commission of the act, they shall impose the penalty in its maximum period.
4. When both mitigating and aggravating circumstances are present, the court shall reasonably offset those of one class against the other according to their relative weight.
5. When there are two or more mitigating circumstances and no aggravating circumstances are present, the court shall impose the penalty next lower to that prescribed by law, in the period that it may deem applicable, according to the number and nature of such circumstances.
6. Whatever may be the number and nature of the aggravating circumstances, the courts shall not impose a greater penalty than that prescribed by law, in its maximum period.
7. Within the limits of each period, the court shall determine the extent of the penalty according to the number and nature of the aggravating and mitigating circumstances and the greater and lesser extent of the evil produced by the crime.