Any person who violates any provision of this chapter or of the code or other regulations relating to this chapter, or who obstructs the commissioner or his agents engaged in their duties under this chapter, for a first offense, shall be fined not more than one hundred dollars and, for each subsequent offense, shall be fined not more than five hundred dollars or imprisoned not more than four month