def METHOD_NAME(reason, object):
    _log.error('error: %s %s', reason, object)
    if reason == 'permissions':
        title = _('Permissions error')
        text = (
            _('Found a Logitech receiver or device (%s), but did not have permission to open it.') % object + '\n\n' +
            _("If you've just installed Solaar, try disconnecting the receiver or device and then reconnecting it.")
        )
    elif reason == 'nodevice':
        title = _('Cannot connect to device error')
        text = (
            _('Found a Logitech receiver or device at %s, but encountered an error connecting to it.') % object + '\n\n' +
            _('Try disconnecting the device and then reconnecting it or turning it off and then on.')
        )
    elif reason == 'unpair':
        title = _('Unpairing failed')
        text = (
            _('Failed to unpair %{device} from %{receiver}.').format(device=object.name, receiver=object.receiver.name) +
            '\n\n' + _('The receiver returned an error, with no further details.')
        )
    else:
        raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object)
    assert title
    assert text
    m = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, text)
    m.set_title(title)
    m.run()
    m.destroy()