'Publish the service.
Call when your service starts.'

def publish(self):

    if _is_loopback_address(self.host):
        logger.debug(u'%s:    Publish    on    loopback    interface    is    not    supported.', self)
        return False
    if (not dbus):
        logger.debug(u'%s:    dbus    not    installed;    publish    failed.', self)
        return False
    if (not self.bus):
        logger.debug(u'%s:    Bus    not    available;    publish    failed.', self)
        return False
    if (not self.server):
        logger.debug(u'%s:    Server    not    available;    publish    failed.', self)
        return False
    try:
        if (not self.bus.name_has_owner(u'org.freedesktop.Avahi')):
            logger.debug(u'%s:    Avahi    service    not    running;    publish    failed.', self)
            return False
        self.group = dbus.Interface(self.bus.get_object(u'org.freedesktop.Avahi', self.server.EntryGroupNew()), u'org.freedesktop.Avahi.EntryGroup')
        self.group.AddService(_AVAHI_IF_UNSPEC, _AVAHI_PROTO_UNSPEC, dbus.UInt32(_AVAHI_PUBLISHFLAGS_NONE), self.name, self.stype, self.domain, self.host, dbus.UInt16(self.port), _convert_text_list_to_dbus_format(self.text))
        self.group.Commit()
        logger.debug(u'%s:    Published', self)
        return True
    except dbus.exceptions.DBusException as e:
        logger.debug(u'%s:    Publish    failed:    %s', self, e)
        return False
