'Helper function to get useful module at self.location in self.course_id for user'

def get_module_for_user(self, user):

    mock_request = MagicMock()
    mock_request.user = user
    field_data_cache = FieldDataCache.cache_for_descriptor_descendents(self.course.id, user, self.course, depth=2)
    return render.get_module(user, mock_request, self.problem.location, field_data_cache)._xmodule
