code: func findControllerForDevice(l object.VirtualDeviceList, bvd types.BaseVirtualDevice) (types.BaseVirtualController, error) {
  	vd := bvd.GetVirtualDevice()
  	ctlr := l.FindByKey(vd.ControllerKey)
  
  	if ctlr == nil {
  		return nil, fmt.Errorf("could not find controller key %d for device %d", vd.ControllerKey, vd.Key)
  	}
  
  	return ctlr.(types.BaseVirtualController), nil
  }
docs: // findControllerForDevice locates a controller via its virtual device.