'returns number of attempts stored for `username` on problem `descriptor` for test course'

def get_num_attempts(self, username, descriptor):

    module = self.get_student_module(username, descriptor)
    state = json.loads(module.state)
    return state['attempts']
