def readstring(format, string, **kwargs):
    format = format.lower()
    if format=="mol" or format=="sdf":
        mol = Chem.MolFromMolBlock(string, **kwargs)
    elif format=="mol2":
        mol = Chem.MolFromMol2Block(string, **kwargs)
    elif format=="pdb":
        mol = Chem.MolFromPDBBlock(string, **kwargs)
    elif format=="smi":
        s = string.split()
        mol = Chem.MolFromSmiles(s[0], **kwargs)
        mol.SetProp("_Name", ' '.join(s[1:]))
    elif format=='inchi' and Chem.INCHI_AVAILABLE:
        mol = Chem.inchi.MolFromInchi(string, **kwargs)
    else:
        raise ValueError,"%s is not a recognised RDKit format" % format
#    if mol:
    return Molecule(mol)
#    else:
#        raise IOError, "Failed to convert '%s' to format '%s'" % (
#            string, format)
Read in a molecule from a string.
dataset/ETHPy150Open oddt/oddt/oddt/toolkits/rdk.py/readstring