Any fence or other structure in the nature of a fence, unnecessarily exceeding 5 feet in height, erected or maintained for the purpose of annoying the owners or occupants of adjoining property shall be deemed a private nuisance.