def verify_for_closed_enrollment(user, cart=None):
 if (cart is None):
  cart = Order.get_cart_for_user(user)
 expired_cart_items = []
 expired_cart_item_names = []
 valid_cart_item_tuples = []
 cart_items = cart.orderitem_set.all().select_subclasses()
 is_any_course_expired = False
 for cart_item in cart_items:
  course_key = getattr(cart_item, 'course_id', None)
  if (course_key is not None):
   course = get_course_by_id(course_key, depth=0)
   if CourseEnrollment.is_enrollment_closed(user, course):
    is_any_course_expired = True
    expired_cart_items.append(cart_item)
    expired_cart_item_names.append(course.display_name)
   else:
    valid_cart_item_tuples.append((cart_item, course))
 return (is_any_course_expired, expired_cart_items, expired_cart_item_names, valid_cart_item_tuples)

def verify_for_closed_enrollment ( user , cart = None ) : if ( cart is None ) : cart = Order . get_cart_for_user ( user ) expired_cart_items = [ ] expired_cart_item_names = [ ] valid_cart_item_tuples = [ ] cart_items = cart . orderitem_set . all ( ) . select_subclasses ( ) is_any_course_expired = False for cart_item in cart_items : course_key = getattr ( cart_item , 'course_id' , None ) if ( course_key is not None ) : course = get_course_by_id ( course_key , depth = 0 ) if CourseEnrollment . is_enrollment_closed ( user , course ) : is_any_course_expired = True expired_cart_items . append ( cart_item ) expired_cart_item_names . append ( course . display_name ) else : valid_cart_item_tuples . append ( ( cart_item , course ) ) return ( is_any_course_expired , expired_cart_items , expired_cart_item_names , valid_cart_item_tuples )
a multi-output helper function .