Any person who, by any unlawful act, or by any intentional omission to do any act which it is the person’s duty to do, causes any engine or vehicle in use upon a railway to be obstructed in its passage on the railway, is guilty of a misdemeanour, and is liable to imprisonment for 2 years.