def invalid_announcement_hostname(hostname: Optional[str]) -> bool:
        """Returns True if hostname unsuited for publishing in a NodeAnnouncement."""
        if (hostname is None or hostname == ""
                or is_private_netaddress(hostname)
                or hostname.startswith("http://")  # not catching 'http' due to onion addresses
                or hostname.startswith("https://")):
            return True
        if hostname.endswith('.onion'):
            if len(hostname) != 62:  # not an onion v3 link (probably onion v2)
                return True
        return False
Returns True if hostname unsuited for publishing in a NodeAnnouncement.
electrum/channel_db.py