(a) An appeal or a bond or undertaking given does not operate to prevent or delay the vesting of title to real property or the right to possession of it.
(b) The plaintiff may not be divested of a title or possession acquired except where the court finds that the property was not taken by necessity for a public use or purpose in a manner compatible with the greatest public good and the least private injury. In the event of that finding, the court shall enter the judgment necessary to (1) compensate the persons entitled to it for the period during which the property was in the possession of the plaintiff, (2) recover for the plaintiff any award paid to any person, and (3) order the plaintiff to restore the property to the condition in which it existed at the time of the filing of the declaration of taking unless such restoration is impossible, in which case the court shall award damages to the proper persons as compensation for any diminution in the value of the property caused by the plaintiff's wrongful possession.