Section 40. An attorney may be removed by the supreme judicial or superior court for deceit, malpractice or other gross misconduct, and shall also be liable in damages to the person injured thereby, and to such other punishment as may be provided by law. Whenever a petition is filed for the removal of an attorney, the proceedings thereafter shall be conducted by an attorney to be designated by the court. The expenses of the inquiry and proceedings in either court shall be paid as in criminal prosecutions in the superior court.