If, in any action, a recovery be had by one party and costs be awarded to the other the court may set off one against the other and render judgment for the balance.