Section 8. Whoever solicits or receives compensation for soliciting for a prostitute shall be punished by imprisonment in a house of correction for not more than 2 and one-half years, or by a fine of not less than $1,000 and not more than $5,000 or by both such imprisonment and fine.