We should be able to delete lines 35 and 36, right?  Since isinstance(course_key, basestring) would return false and the else clause would do the same as line 36.