def _get_node_id(node, handler, node_map):
    candidates = []
    for mac in node.get('mac', []):
        try:
            candidates.append(node_map['mac'][mac.lower()])
        except __HOLE__:
            pass

    unique_id = handler.unique_id_from_fields(node)
    if unique_id:
        try:
            candidates.append(node_map['pm_addr'][unique_id])
        except KeyError:
            pass

    if len(candidates) > 1:
        raise exception.InvalidNode('Several candidates found for the same '
                                    'node data: %s' % candidates,
                                    node=node)
    elif candidates:
        return candidates[0]
dataset/ETHPy150Open openstack/tripleo-common/tripleo_common/utils/nodes.py/_get_node_id