§ 988. Remedy of occupant for taxes paid by him. If a tax upon real property has been collected from any occupant, and any other person by agreement or otherwise is liable to pay such tax or any part thereof, such occupant shall be entitled to recover the amount which such person should have paid or to retain the same from any rent due or accruing from him to such person for the land on which the tax was paid.