You can just use `get_instance`, and if `module_id` point's to a course, you'll get the same thing you'd get using `get_course`.