def get_charge(molecule):
    """
    Get charge state of molecule

    Parameters
    ----------
    molecule:
        `oechem.OEMol` or `rdkit.Chem.Mol`

    Returns
    -------
    int
        total charge of molecule

    """

    charge = 0
    for atom in molecule.GetAtoms():
        charge += atom.GetFormalCharge()
    return charge