'Determines the device bus and its hypervisor assigned address'

@staticmethod
def _prepare_device_bus(dev):

    bus = None
    address = (dev.device_addr.format_address() if dev.device_addr else None)
    if isinstance(dev.device_addr, vconfig.LibvirtConfigGuestDeviceAddressPCI):
        bus = objects.PCIDeviceBus()
    elif isinstance(dev, vconfig.LibvirtConfigGuestDisk):
        if (dev.target_bus == 'scsi'):
            bus = objects.SCSIDeviceBus()
        elif (dev.target_bus == 'ide'):
            bus = objects.IDEDeviceBus()
        elif (dev.target_bus == 'usb'):
            bus = objects.USBDeviceBus()
    if ((address is not None) and (bus is not None)):
        bus.address = address
    return bus
