If a defendant having a right to counsel in a criminal proceeding has not been represented by counsel or has not properly waived his right to counsel and has entered a plea of guilty, such defendant may withdraw such plea as a matter of right at any time prior to imposition of sentence by the court.
Mass. Gen. Laws ch. 278, § 29B