code: def subscriber_has_active_subscription(subscriber, plan=None):
  	
  	if isinstance(subscriber, AnonymousUser):
  		raise ImproperlyConfigured(ANONYMOUS_USER_ERROR_MSG)
  
  	if isinstance(subscriber, get_user_model()):
  		if subscriber.is_superuser or subscriber.is_staff:
  			return True
  	from .models import Customer
  
  	customer, created = Customer.get_or_create(subscriber)
  	if created or not customer.has_active_subscription(plan):
  		return False
  	return True
docs: Helper function to check if a subscriber has an active subscription.
  
  	Throws improperlyConfigured if the subscriber is an instance of AUTH_USER_MODEL
  	and get_user_model().is_anonymous == True.
  
  	Activate subscription rules (or):
  		* customer has active subscription
  
  	If the subscriber is an instance of AUTH_USER_MODEL, active subscription rules (or):
  		* customer has active subscription
  		* user.is_superuser
  		* user.is_staff
  
  	:param subscriber: The subscriber for which to check for an active subscription.
  	:type subscriber: dj-stripe subscriber
  	:param plan: The plan for which to check for an active subscription. If plan is None and
  				there exists only one subscription, this method will check if that subscription
  				is active. Calling this method with no plan and multiple subscriptions will throw
  				an exception.
  	:type plan: Plan or string (plan ID)