Section 62. If a complaint charges a person with being a common nightwalker, and it is proved at the trial that such person has been twice before convicted of the same offence, such person may be sentenced to the house of correction for not more than two and one half years or if a male, to the Massachusetts reformatory, or if a female, to the reformatory for women.