def load_sbml(filename):
    """
    Load a model from a SBML file.

    Parameters
    ----------
    filename : str
        The input SBML filename.

    Returns
    -------
    model : NetworkModel
    y0 : dict
        Initial condition.
    volume : Real or Real3, optional
        A size of the simulation volume.

    """
    import libsbml

    document = libsbml.readSBML(filename)
    document.validateSBML()
    num_errors = (document.getNumErrors(libsbml.LIBSBML_SEV_ERROR)
                  + document.getNumErrors(libsbml.LIBSBML_SEV_FATAL))
    if num_errors > 0:
        messages = "The generated document is not valid."
        messages += " {} errors were found:\n".format(num_errors)
        for i in range(document.getNumErrors(libsbml.LIBSBML_SEV_ERROR)):
            err = document.getErrorWithSeverity(i, libsbml.LIBSBML_SEV_ERROR)
            messages += "{}: {}\n".format(err.getSeverityAsString(), err.getShortMessage())
        for i in range(document.getNumErrors(libsbml.LIBSBML_SEV_FATAL)):
            err = document.getErrorWithSeverity(i, libsbml.LIBSBML_SEV_FATAL)
            messages += "{}: {}\n".format(err.getSeverityAsString(), err.getShortMessage())
        raise RuntimeError(messages)
    return import_sbml(document)
Load a model from a SBML file.

    Parameters
    ----------
    filename : str
        The input SBML filename.

    Returns
    -------
    model : NetworkModel
    y0 : dict
        Initial condition.
    volume : Real or Real3, optional
        A size of the simulation volume.