(1) If a sheriff decides not to make an order under section 131A(3), an appropriate officer may appeal to the Court of Session.
(1A) If a sheriff decides not to make an order under section 131ZB(3) or 131AA(2), the prosecutor may appeal to the Court of Session.
(2) If a sheriff makes an order under section 131ZB(3), 131A(3) or 131AA(2), a person affected by the order may appeal to the Court of Session.
(3) But the person mentioned in section 131ZB(2)(a), 131A(2)(a) or 131AA(2)(a) (as applicable) may not appeal.
(4) An appropriate officer may appeal to the Court of Session against -
(a) a determination made by a sheriff under section 131B;
(b) a decision by a sheriff not to make a determination under that section.
(5) An appeal under this section must be made before the end of the period of 21 days starting with the day on which the decision or (as the case may be) the order was made.
(6) On an appeal under this section the Court of Session may -
(a) confirm, quash or vary the decision
…