Section 4. (a) A defendant may file a notice of appeal for review of an otherwise final sentence if:
(1) the sentence was imposed in violation of law; or
(2) the sentence was imposed as a result of an incorrect application of the sentencing guidelines; or
(3) the departure upward from the applicable guideline range was an abuse of discretion; or
(4) the sentence was imposed for an offense for which there is no sentencing guideline and is plainly unreasonable.
(b) The commonwealth, with the personal approval of the attorney general or a district attorney, may appeal an otherwise final sentence if:
(1) the sentence was imposed in violation of law;
(2) the sentence was imposed as a result of an incorrect application of the sentencing guidelines;
(3) the departure downward from the applicable guideline range was an abuse of discretion; or
(4) the sentence was imposed for an offense for which there is no sentencing guideline and is plainly unreasonable.
(c) In the case of a plea agreement entered into pursuant to Rule twelve of the Massachusetts rules of criminal procedure:
(1) a defendant may not appeal a sentence unless the sentence imposed is greater than the sentence prescribed by the sentencing guidelines; and
(2) the commonwealth may not appeal a sentence unless the sentence imposed is less than the sentence prescribed by the sentencing guidelines.
(3) a sentence imposed by the court in accordance with the recommendation of either the defendant or the commonwealth may not be appealed by the party which made the recommendation; and a sentence imposed in accordance with a jointly-agreed recommendation may not be appealed by either the defendant or the commonwealth.
(d) Appeals from sentences imposed under the sentencing guidelines shall be conducted in accordance with the Massachusetts rules of appellate procedure.
(e) If imprisonment is imposed, the entry of an appeal under the provisions of this section shall not stay the execution of the sentence unless the judge imposing it, upon a showing of a reasonable likelihood of success, finds that execution of the sentence should be stayed pending final determination of the appeal.