code: func (na *cnmNetworkAllocator) IsAttachmentAllocated(node *api.Node, networkAttachment *api.NetworkAttachment) bool {
  	if node == nil {
  		return false
  	}
  
  	if networkAttachment == nil || networkAttachment.Network == nil {
  		return false
  	}
  
  	// If the node is not found in the allocated set, then it is
  	// not allocated.
  	if _, ok := na.nodes[node.ID]; !ok {
  		return false
  	}
  
  	// If the nework is not found in the allocated set, then it is
  	// not allocated.
  	if _, ok := na.nodes[node.ID][networkAttachment.Network.ID]; !ok {
  		return false
  	}
  
  	// If the network is not allocated, the node cannot be allocated.
  	localNet, ok := na.networks[networkAttachment.Network.ID]
  	if !ok {
  		return false
  	}
  
  	// Addresses empty, not allocated.
  	if len(networkAttachment.Addresses) == 0 {
  		return false
  	}
  
  	// The allocated IP address not found in local endpoint state. Not allocated.
  	if _, ok := localNet.endpoints[networkAttachment.Addresses[0]]; !ok {
  		return false
  	}
  
  	return true
  }
docs: // IsAttachmentAllocated returns if the passed node and network has resources allocated or not.