def _bonds(mol, node_idx, use_order=True):
    """
    Returns how many explicit bonds the specified node has. If use_order is
    False, treat all bonds as if they are order 1.
    Parameters
    ----------
    mol : nx.Graph
        The molecule.
    node_idx : hashable
        The node to look at. Should be in mol.
    use_order : bool
        If False, treat all bonds as single.
    Returns
    -------
    int
        The number of bonds.
    """
    if use_order:
        # bond_orders = map(operator.itemgetter(2),
        #                   mol.edges(nbunch=node_idx, data='order', default=1))
        bond_orders = map(lambda atom: getattr(atom, 'order', 1), node_idx.bondedAtoms)
        bonds = sum(bond_orders)
    else:
        bonds = len(mol[node_idx])
    return bonds