Can I change the membership level via code for Membership plugin

I need to be able to change a users membership level from a custom plugin I am creating. It's a quiz and when they pass it, their membership level changes.

how can I invoke a change in the users level in PHP?