'Displays the course mode choice page.
Args:
request (`Request`): The Django Request object.
course_id (unicode): The slash-separated course key.
Keyword Args:
error (unicode): If provided, display this error message
on the page.
Returns:
Response'

@method_decorator(tpa_hint_ends_existing_session)
@method_decorator(login_required)
@method_decorator(transaction.atomic)
def get(self, request, course_id, error=None):

    course_key = CourseKey.from_string(course_id)
    embargo_redirect = embargo_api.redirect_if_blocked(course_key, user=request.user, ip_address=get_ip(request), url=request.path)
    if embargo_redirect:
        return redirect(embargo_redirect)
    (enrollment_mode, is_active) = CourseEnrollment.enrollment_mode_for_user(request.user, course_key)
    modes = CourseMode.modes_for_course_dict(course_key)
    ecommerce_service = EcommerceService()
    has_enrolled_professional = (CourseMode.is_professional_slug(enrollment_mode) and is_active)
    if (CourseMode.has_professional_mode(modes) and (not has_enrolled_professional)):
        purchase_workflow = request.GET.get('purchase_workflow', 'single')
        verify_url = reverse('verify_student_start_flow', kwargs={'course_id': unicode(course_key)})
        redirect_url = '{url}?purchase_workflow={workflow}'.format(url=verify_url, workflow=purchase_workflow)
        if ecommerce_service.is_enabled(request.user):
            professional_mode = (modes.get(CourseMode.NO_ID_PROFESSIONAL_MODE) or modes.get(CourseMode.PROFESSIONAL))
            if ((purchase_workflow == 'single') and professional_mode.sku):
                redirect_url = ecommerce_service.get_checkout_page_url(professional_mode.sku)
            if ((purchase_workflow == 'bulk') and professional_mode.bulk_sku):
                redirect_url = ecommerce_service.get_checkout_page_url(professional_mode.bulk_sku)
        return redirect(redirect_url)
    if (not CourseMode.has_verified_mode(modes)):
        return redirect(reverse('dashboard'))
    if (is_active and (enrollment_mode in (CourseMode.VERIFIED_MODES + [CourseMode.NO_ID_PROFESSIONAL_MODE]))):
        return redirect(reverse('dashboard'))
    donation_for_course = request.session.get('donation_for_course', {})
    chosen_price = donation_for_course.get(unicode(course_key), None)
    course = modulestore().get_course(course_key)
    if CourseEnrollment.is_enrollment_closed(request.user, course):
        locale = to_locale(get_language())
        enrollment_end_date = format_datetime(course.enrollment_end, 'short', locale=locale)
        params = urllib.urlencode({'course_closed': enrollment_end_date})
        return redirect('{0}?{1}'.format(reverse('dashboard'), params))
    has_credit_upsell = any((CourseMode.is_credit_mode(mode) for mode in CourseMode.modes_for_course(course_key, only_selectable=False)))
    course_id = course_key.to_deprecated_string()
    context = {'course_modes_choose_url': reverse('course_modes_choose', kwargs={'course_id': course_id}), 'modes': modes, 'has_credit_upsell': has_credit_upsell, 'course_name': course.display_name_with_default_escaped, 'course_org': course.display_org_with_default, 'course_num': course.display_number_with_default, 'chosen_price': chosen_price, 'error': error, 'responsive': True, 'nav_hidden': True}
    context.update(get_experiment_user_metadata_context(request, course, request.user))
    title_content = _('Congratulations!        You    are    now    enrolled    in    {course_name}').format(course_name=course.display_name_with_default_escaped)
    enterprise_learner_data = enterprise_api.get_enterprise_learner_data(site=request.site, user=request.user)
    if enterprise_learner_data:
        enterprise_learner = enterprise_learner_data[0]
        is_course_in_enterprise_catalog = enterprise_api.is_course_in_enterprise_catalog(site=request.site, course_id=course_id, enterprise_catalog_id=enterprise_learner['enterprise_customer']['catalog'])
        if is_course_in_enterprise_catalog:
            partner_names = partner_name = (course.display_organization if course.display_organization else course.org)
            enterprise_name = enterprise_learner['enterprise_customer']['name']
            organizations = organization_api.get_course_organizations(course_id=course.id)
            if organizations:
                partner_names = '    and    '.join([org.get('name', partner_name) for org in organizations])
            title_content = _('Welcome,    {username}!    You    are    about    to    enroll    in    {course_name},    from    {partner_names},    sponsored    by    {enterprise_name}.    Please    select    your    enrollment    information    below.').format(username=request.user.username, course_name=course.display_name_with_default_escaped, partner_names=partner_names, enterprise_name=enterprise_name)
            if (not enterprise_learner['enterprise_customer'].get('enable_audit_enrollment')):
                for audit_mode in CourseMode.AUDIT_MODES:
                    modes.pop(audit_mode, None)
    context['title_content'] = title_content
    if ('verified' in modes):
        verified_mode = modes['verified']
        context['suggested_prices'] = [decimal.Decimal(x.strip()) for x in verified_mode.suggested_prices.split(',') if x.strip()]
        context['currency'] = verified_mode.currency.upper()
        context['min_price'] = verified_mode.min_price
        context['verified_name'] = verified_mode.name
        context['verified_description'] = verified_mode.description
        if verified_mode.sku:
            context['use_ecommerce_payment_flow'] = ecommerce_service.is_enabled(request.user)
            context['ecommerce_payment_page'] = ecommerce_service.payment_page_url()
            context['sku'] = verified_mode.sku
            context['bulk_sku'] = verified_mode.bulk_sku
    return render_to_response('course_modes/choose.html', context)
