'Turns a (json) dictionary into a Node object.
This returns only running VMs.'

def _to_node(self, vm):

    if (not (vm['state'] == 'running')):
        return None
    iplist = [interface['ip'] for interface in vm['interfaces'] if (interface['ip'] != '127.0.0.1')]
    public_ips = []
    private_ips = []
    for ip in iplist:
        try:
            socket.inet_aton(ip)
        except socket.error:
            continue
        if is_private_subnet(ip):
            private_ips.append(ip)
        else:
            public_ips.append(ip)
    n = Node(id=vm['uuid'], name=vm['name'], state=NodeState.RUNNING, public_ips=public_ips, private_ips=private_ips, driver=self)
    return n
