code: func taskReadyForNetworkVote(t *api.Task, s *api.Service, nc *networkContext) bool {
  	// Task is ready for vote if the following is true:
  	//
  	// Task has no network attached or networks attached but all
  	// of them allocated AND Task's service has no endpoint or
  	// network configured or service endpoints have been
  	// allocated.
  	return (len(t.Networks) == 0 || nc.nwkAllocator.IsTaskAllocated(t)) &&
  		(s == nil || nc.nwkAllocator.IsServiceAllocated(s))
  }
docs: // taskReadyForNetworkVote checks if the task is ready for a network
  // vote to move it to PENDING state.