'Check if a user has completed a course.
A course is completed if the user has earned a certificate for any of
the nested course runs.
Arguments:
course (dict): Containing nested course runs.
Returns:
bool, indicating whether the course is complete.'

def _is_course_complete(self, course):

    def reshape(course_run):
        '\n                                                Modify    the    structure    of    a    course    run    dict    to    facilitate    comparison\n                                                with    course    run    certificates.\n                                                '
        return {'course_run_id': course_run['key'], 'type': ('verified' if (course_run['type'] == 'credit') else course_run['type'])}
    return any(((reshape(course_run) in self.completed_course_runs) for course_run in course['course_runs']))
