A court may, in and by a conviction or order, order an accused person to pay to the registrar of the court, for payment to the prosecutor, such costs as the court specifies or, if the conviction or order directs, as may be determined under section 257G, if--
(a) the court convicts the accused person of an offence, or
(b) the court makes an order under section 10 of the Crimes (Sentencing Procedure) Act 1999 in respect of an offence.