def _get_zendesk_custom_field_context(request):
 context = {}
 course_id = request.POST.get('course_id')
 if (not course_id):
  return context
 context['course_id'] = course_id
 if (not request.user.is_authenticated()):
  return context
 enrollment = CourseEnrollment.get_enrollment(request.user, CourseKey.from_string(course_id))
 if (enrollment and enrollment.is_active):
  context['enrollment_mode'] = enrollment.mode
 return context

def _get_zendesk_custom_field_context ( request ) : context = { } course_id = request . POST . get ( 'course_id' ) if ( not course_id ) : return context context [ 'course_id' ] = course_id if ( not request . user . is_authenticated ( ) ) : return context enrollment = CourseEnrollment . get_enrollment ( request . user , CourseKey . from_string ( course_id ) ) if ( enrollment and enrollment . is_active ) : context [ 'enrollment_mode' ] = enrollment . mode return context
construct a dictionary of data that can be stored in zendesk custom fields .