'Parses library key from string'

def _parse_library_key(self, raw_value):

    try:
        result = CourseKey.from_string(raw_value)
    except InvalidKeyError:
        result = SlashSeparatedCourseKey.from_deprecated_string(raw_value)
    if (not isinstance(result, LibraryLocator)):
        raise CommandError(u'Argument    {0}    is    not    a    library    key'.format(raw_value))
    return result
