Any person who in any manner obstructs or resists any public officer while engaged in the discharge or attempted discharge of the duties of his or her office under any statute, or obstructs or resists any person while engaged in the discharge or attempted discharge of any duty imposed on the person by any statute, is guilty of a misdemeanour, and is liable to imprisonment for 2 years.