def _get_module_instance_for_task(course_id, student, module_descriptor, xmodule_instance_args=None, grade_bucket_type=None, course=None):
 field_data_cache = FieldDataCache.cache_for_descriptor_descendents(course_id, student, module_descriptor)
 student_data = KvsFieldData(DjangoKeyValueStore(field_data_cache))
 request_info = (xmodule_instance_args.get('request_info', {}) if (xmodule_instance_args is not None) else {})
 task_info = {'student': student.username, 'task_id': _get_task_id_from_xmodule_args(xmodule_instance_args)}
 def make_track_function():
  '\n        Make a tracking function that logs what happened.\n\n        For insertion into ModuleSystem, and used by CapaModule, which will\n        provide the event_type (as string) and event (as dict) as arguments.\n        The request_info and task_info (and page) are provided here.\n        '
  return (lambda event_type, event: task_track(request_info, task_info, event_type, event, page='x_module_task'))
 xqueue_callback_url_prefix = (xmodule_instance_args.get('xqueue_callback_url_prefix', '') if (xmodule_instance_args is not None) else '')
 return get_module_for_descriptor_internal(user=student, descriptor=module_descriptor, student_data=student_data, course_id=course_id, track_function=make_track_function(), xqueue_callback_url_prefix=xqueue_callback_url_prefix, grade_bucket_type=grade_bucket_type, request_token=None, course=course)

def _get_module_instance_for_task ( course_id , student , module_descriptor , xmodule_instance_args = None , grade_bucket_type = None , course = None ) : field_data_cache = FieldDataCache . cache_for_descriptor_descendents ( course_id , student , module_descriptor ) student_data = KvsFieldData ( DjangoKeyValueStore ( field_data_cache ) ) request_info = ( xmodule_instance_args . get ( 'request_info' , { } ) if ( xmodule_instance_args is not None ) else { } ) task_info = { 'student' : student . username , 'task_id' : _get_task_id_from_xmodule_args ( xmodule_instance_args ) } def make_track_function ( ) : return ( lambda event_type , event : task_track ( request_info , task_info , event_type , event , page = 'x_module_task' ) ) xqueue_callback_url_prefix = ( xmodule_instance_args . get ( 'xqueue_callback_url_prefix' , '' ) if ( xmodule_instance_args is not None ) else '' ) return get_module_for_descriptor_internal ( user = student , descriptor = module_descriptor , student_data = student_data , course_id = course_id , track_function = make_track_function ( ) , xqueue_callback_url_prefix = xqueue_callback_url_prefix , grade_bucket_type = grade_bucket_type , request_token = None , course = course )
fetches a studentmodule instance for a given course_id .