Limiting the number of appoinment based on membership plan

https://premium.wpmudev.org/forums/topic/limiting-the-number-of-appointments-per-a-month-per-user#post-650382

Thanks for the code provided, it works.
But is that possible to set limit based on membership subscription? I will add the code to function.php

For example:
Membership A - 1 appointment
Membership B - 3 appointments
Membership C - 5 appointments