For the effectual exercise of the powers conferred in the last section a judicial officer may punish for contempt in the cases and in the manner provided by law.