Assistance rewriting a custom function for Membership'1' Pro to work with Membership2 Pro

Hi there,
I'm currently in the process of modifying an existing site to work with the Membership2 Pro plugin. I currently have the following function used (to track down a user's current subscription level) in my extended functions.php file:

// Get user subscription level by user id
// -------------------------------------
function get_sub_by_user( $user_id ) {
	$factory = Membership_Plugin::factory();
	$user_object = $factory->get_member( $user_id );
	$userlevels = $user_object->get_level_ids();
	if (!empty($userlevels)) {
		$rows = array();
		foreach ((array) $userlevels as $key => $value) {
			$level = Membership_Plugin::factory()->get_level($value->level_id);
			if (!empty($level)) {
				$rows[] = $level->level_title();
		return $rows;
	} else {
		return false;

Essentially I need a function to (based on user id) return either the name of the current membership level / subscription, or if not then return false.
I believe I modded this from something I saw on these forums a few years back, but I can't find the link.
Could someone advise me on the best practice for doing this with the new plugin?

P.S. If I'm missing some api docs or something that will tell me this please feel free to point me there and close this question!