In each case of a contested primary election, the court may require the contestant to post bond for the costs and expenses of the election contest. The costs and expenses of any election contest, including the cost and expense of a recount, may be adjudged against the unsuccessful party with the payment of the costs and expenses enforceable as in civil cases.