It shall be the duty of every owner of any animal, or anyone having any animal in his possession or custody, to insure that it is enclosed by way of a fence or other enclosure or is restrained by chain or leash or in some other physical manner so that it cannot wander off of the real property limits of the owner, possessor or custodian except as hereinafter provided, it being the intent of this section that all animals be prevented from leaving while unattended, the real property limits of their owners, possessors, or custodians thereof. Failure to comply with this section shall be unlawful and shall be punishable as hereinafter provided.