def _parse_annotations(sbase):
annotation = {}<EOL>if sbase.isSetSBOTerm():<EOL><INDENT>annotation["<STR_LIT>"] = sbase.getSBOTermID()<EOL><DEDENT>cvterms = sbase.getCVTerms()<EOL>if cvterms is None:<EOL><INDENT>return annotation<EOL><DEDENT>for cvterm in cvterms:  <EOL><INDENT>for k in range(cvterm.getNumResources()):<EOL><INDENT>uri = cvterm.getResourceURI(k)<EOL>match = URL_IDENTIFIERS_PATTERN.match(uri)<EOL>if not match:<EOL><INDENT>LOGGER.warning("<STR_LIT>"<EOL>"<STR_LIT>", uri)<EOL>continue<EOL><DEDENT>provider, identifier = match.group(<NUM_LIT:1>), match.group(<NUM_LIT:2>)<EOL>if provider in annotation:<EOL><INDENT>if isinstance(annotation[provider], string_types):<EOL><INDENT>annotation[provider] = [annotation[provider]]<EOL><DEDENT>if identifier not in annotation[provider]:<EOL><INDENT>annotation[provider].append(identifier)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>annotation[provider] = identifier<EOL><DEDENT><DEDENT><DEDENT>return annotation<EOL>
Parses cobra annotations from a given SBase object.

    Annotations are dictionaries with the providers as keys.

    Parameters
    ----------
    sbase : libsbml.SBase
        SBase from which the SBML annotations are read

    Returns
    -------
    dict (annotation dictionary)

    FIXME: annotation format must be updated (this is a big collection of
          fixes) - see: https://github.com/opencobra/cobrapy/issues/684)