Every society incorporated and organized for the prevention of cruelty to animals may enter into a contract with any city, city and county, or county, where the society is located, to enforce the provisions of laws of this state for the prevention of cruelty to animals, or arresting or prosecuting offenders thereunder, or preventing cruelty to animals. A humane society may perform those actions in the absence of a contract with a city, city and county, or county.