Get Member Subscription and Access Level

I installed the membership plugin. And I had a custom page which I want to add custom code to limit the access to this page. I tried to add the following code to get the member subscription and access level.

$isMember = current_user_is_member(); // Check if current user is member
		if ($isMember){
			$user = wp_get_current_user(); // Get Current User
			$member = new M_Membership( $user->ID ); // Get Member Data
			$isActive = $member->active_member();  // Get Active Status
			if ($isActive){
				$sub_ids = $member->get_subscription_ids(); // Get Subscription IDs
				$level_ids = $member->get_level_ids(); // Get Access Level IDs
				foreach ($sub_ids as $id){
					$subscription = new M_Subscription($id);
					echo 'Subscription: '.$subscription->sub_name().' (Sub ID:'.$id.') <br />';
				}
				print_r($level_ids);
				print_r($member->current_subscription());
			} else {
				echo "This is an inactive member<br />";
			}
		} else {
			echo "This is not a member<br />";
		}

My question is: If the subscription has been expired, will it still return the expired subscription id to me from the above code? Or how can I filter out the expired subscription or access level?