Section 39. A person not a resident of but found within the commonwealth may be summoned and compelled to give his deposition at any place within ten miles of the place at which the summons is served upon him, in like manner and under the same penalties as he may be summoned and compelled to attend as a witness before a court.