If the legal services have been provided by a public defender or an attorney with whom a contract has been entered into to provide services in lieu of a public defender, a public defender's lien shall be set by a judge of the circuit court or magistrate judge at a reasonable amount for the services rendered.
SDCL 23A-40-12