def course_context_from_url(url):
 url = (url or '')
 match = COURSE_REGEX.match(url)
 course_id = None
 if match:
  course_id_string = match.group('course_id')
  try:
   course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id_string)
  except InvalidKeyError:
   log.warning('unable to parse course_id "{course_id}"'.format(course_id=course_id_string), exc_info=True)
 return course_context_from_course_id(course_id)

def course_context_from_url ( url ) : url = ( url or '' ) match = COURSE_REGEX . match ( url ) course_id = None if match : course_id_string = match . group ( 'course_id' ) try : course_id = SlashSeparatedCourseKey . from_deprecated_string ( course_id_string ) except InvalidKeyError : log . warning ( 'unable to parse course_id "{course_id}"' . format ( course_id = course_id_string ) , exc_info = True ) return course_context_from_course_id ( course_id )
extracts the course_context from the given url and passes it on to course_context_from_course_id() .