The person or officer taking up such livestock or animal shall be entitled to possession thereof until the judgment which may be recovered as provided in this chapter is paid, together with the costs of the same and the cost of keeping and caring for such livestock or animal after such judgment or until the same is sold under execution to satisfy said judgment; provided, that the cost of keeping and caring for such livestock or animal under such circumstances shall be upon the same basis as that previously determined as a proper charge for the maintenance of such livestock or animal prior to the entering of such judgment.