All of the following are deemed excepted to: the verdict of the jury; the final decision in an action or proceeding; an interlocutory order or decision, finally determining the rights of the parties, or some of them; an order or decision from which an appeal may be taken; an order sustaining or overruling a demurrer, allowing or refusing to allow an amendment to a pleading, striking out or refusing to strike out a pleading or a portion thereof, or refusing a continuance; an order made upon ex parte
(a) When a judgment of imprisonment is imposed, or the execution of a judgment of imprisonment is ordered suspended, the sentencing judge must, in their sound discretion, order imposition of a sentence not to exceed the middle term, except as otherwise provided in paragraph (b). (b) The court may only choose an upper term when (1) there are circumstances in aggravation of the crime that justify the imposition of an upper term, and (2) the facts underlying those circumstances have been (i) stipulated