def guess_backend(identifier):
    """ guess the backend from a given identifier string for the device """
    if identifier.startswith('usb://') or identifier.startswith('0x'):
        return 'pyusb'
    elif identifier.startswith('file://') or identifier.startswith('/dev/usb/') or identifier.startswith('lp'):
        return 'linux_kernel'
    elif identifier.startswith('tcp://'):
        return 'network'
    else:
        raise ValueError('Cannot guess backend for given identifier: %s' % identifier)
guess the backend from a given identifier string for the device