def course_id_from_url(url):
 if (not url):
  return None
 match = COURSE_REGEX.match(url)
 if (match is None):
  return None
 course_id = match.group('course_id')
 if (course_id is None):
  return None
 try:
  return SlashSeparatedCourseKey.from_deprecated_string(course_id)
 except InvalidKeyError:
  return None

def course_id_from_url ( url ) : if ( not url ) : return None match = COURSE_REGEX . match ( url ) if ( match is None ) : return None course_id = match . group ( 'course_id' ) if ( course_id is None ) : return None try : return SlashSeparatedCourseKey . from_deprecated_string ( course_id ) except InvalidKeyError : return None
extracts the course_id from the given url .