(a) For the purposes of this section, the following terms shall have the following meanings:
(1) AGRICULTURAL WORK DOG. Any dog that is trained to herd or protect livestock or to otherwise assist in agricultural work and is actually or has been used for such purposes.
(2) HUNTING DOG. Any dog trained to hunt wild game with a handler.
(b) A local law requiring a dog to be kept on a leash or otherwise restrained does not apply to an agricultural work dog at any time while the dog is engaged in agricultural work or a hunting dog at any time while the dog is engaged in hunting wild game.