The sheriff shall attend upon the district court at its session in his or her county, shall be allowed the assistance of two deputies and of such further number as the court may direct, and shall attend the sessions of the county court when required by the judge.