def create_node_from_server(server):
    """ Translate GCP Compute Instance representation into a Node object.
    """
    # TODO: Sometimes Compute instances lose the Public IP, so this is a
    # temporal workaround
    try:
        public_ip = server["networkInterfaces"][0]["accessConfigs"][0]["natIP"]
    except Exception:
        public_ip = 'None'

    return Node(
        id=server['id'],
        ip=server["networkInterfaces"][0]["networkIP"],
        extIp=public_ip,
        az=server['zone'].rsplit('/', 1)[1],
        name=server['name'],
        state=server_status_to_state(server['status']),
    )
 Translate GCP Compute Instance representation into a Node object.
    
powerfulseal/clouddrivers/gcp_driver.py