A city of the second class shall have the power by ordinance to prohibit and punish cruelty to animals.