def _attach_device(self, device, bus, dma_ports=None):
    if hasattr(device, 'pio'):
        device.pio = bus.master
    if hasattr(device, 'dma'):
        if (dma_ports is None):
            device.dma = bus.slave
        else:
            dma_ports.append(device.dma)
def _attach_device(self, device, bus, dma_ports=None):
    if hasattr(device, 'pio'):
        device.pio = bus.master
    if hasattr(device, 'dma'):
        if (dma_ports is None):
            device.dma = bus.slave
        else:
            dma_ports.append(device.dma)