When any surety or stayor is compelled to pay a general sessions court’s judgment against a principal debtor for which the surety or stayor is liable, the surety or stayor may, by motion, before the general sessions court having legal custody of the judgment, recover judgment against the principal debtor for the judgment with interest and costs, or against a cosurety or stayor, for the ratable part thereof, which judgment is not liable to be stayed, except by consent of the surety or stayor in writing.