Except in cases where a different punishment is prescribed by any law of this state, every offense declared to be a misdemeanor is punishable by imprisonment in the county jail not exceeding six months, or by fine not exceeding one thousand dollars ($1,000), or by both.