# Buggy code
def send(self, body, title="", notify_type=NotifyType.INFO, **kwargs):
    """
    Perform XMPP Notification
    """

    if not self._enabled:
        self.logger.warning(
            "XMPP Notifications are not supported by this system - install sleekxmpp."
        )
        return False

    # Detect our JID if it isn't otherwise specified
    jid = self.jid
    password = self.password
    if not jid:
        if self.user and self.password:
            # xmpp://user:password@hostname
            jid = "{}@{}".format(self.user, self.host)

        else:
            # xmpp://password@hostname
            jid = self.host
            password = self.password if self.password else self.user

    # Compute port number
    if not self.port:
        port = self.default_secure_port if self.secure else self.default_unsecure_port

    else:
        port = self.port

    try:
        # Communicate with XMPP.
        xmpp_adapter = SleekXmppAdapter(
            host=self.host,
            port=port,
            secure=self.secure,
            verify_certificate=self.verify_certificate,
            xep=self.xep,
            jid=jid,
            password=password,
            body=body,
            targets=self.targets,
            before_message=self.throttle,
            logger=self.logger,
        )

    except ValueError:
        # We failed
        return False

    # Initialize XMPP machinery and begin processing the XML stream.
    outcome = xmpp_adapter.process()

    return outcome


# Traceback (ValueError)
2020-04-06 10:04:39,084 - DEBUG - Loaded URL: xmpp://user:password@xmpp.nayr.us/user%40nayr.us?verify=yes&amp;overflow=upstream&amp;xep=30%2C199&amp;format=text
2020-04-06 10:04:39,087 - DEBUG - Loaded Plugin: RFC 6120: Stream Feature: STARTTLS
2020-04-06 10:04:39,087 - DEBUG - Loaded Plugin: RFC 6120: Stream Feature: Resource Binding
2020-04-06 10:04:39,088 - DEBUG - Loaded Plugin: RFC 3920: Stream Feature: Start Session
2020-04-06 10:04:39,089 - DEBUG - Loaded Plugin: RFC 6121: Stream Feature: Roster Versioning
2020-04-06 10:04:39,090 - DEBUG - Loaded Plugin: RFC 6121: Stream Feature: Subscription Pre-Approval
2020-04-06 10:04:39,093 - DEBUG - Loaded Plugin: RFC 6120: Stream Feature: SASL
2020-04-06 10:04:39,095 - DEBUG - Loaded Plugin: XEP-0030: Service Discovery
2020-04-06 10:04:39,096 - DEBUG - Loaded Plugin: XEP-0199: XMPP Ping
2020-04-06 10:04:39,096 - DEBUG - DNS: Querying xmpp.nayr.us for AAAA records.
2020-04-06 10:04:39,099 - DEBUG - DNS: No AAAA records for xmpp.nayr.us
2020-04-06 10:04:39,099 - DEBUG - DNS: Querying xmpp.nayr.us for A records.
2020-04-06 10:04:39,103 - DEBUG - Connecting to 172.16.129.15:5222
2020-04-06 10:04:39,103 - DEBUG - Event triggered: connected
2020-04-06 10:04:39,103 - DEBUG -  ==== TRANSITION disconnected -> connected
2020-04-06 10:04:39,104 - DEBUG - Starting HANDLER THREAD
2020-04-06 10:04:39,104 - DEBUG - Loading event runner
2020-04-06 10:04:39,105 - DEBUG - SEND (IMMED): <stream:stream to='xmpp.nayr.us' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
2020-04-06 10:04:39,113 - DEBUG - RECV: <stream:stream version="1.0" from="xmpp.nayr.us" id="8527860a-fcb1-49d6-a601-89b93dabcaac" xml:lang="en">
2020-04-06 10:04:39,114 - DEBUG - RECV: <stream:features xmlns="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls></stream:features>
2020-04-06 10:04:39,115 - DEBUG - SEND (IMMED): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls>
2020-04-06 10:04:39,117 - DEBUG - RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
2020-04-06 10:04:39,117 - DEBUG - Starting TLS
2020-04-06 10:04:39,117 - INFO - Negotiating TLS
2020-04-06 10:04:39,117 - INFO - Using SSL version: TLSv1
2020-04-06 10:04:39,618 - DEBUG - CERT: -----BEGIN CERTIFICATE-----
MIIG9zCCBd+gAwIBAgISAx4xdCT+J2NntCKIHvypzA9sMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw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0Yc3ryWIq+YNpyVPprQ
BbcnS8n0V9smpO/1PbxmhQGXKfTNSaFnG6VxjOaKaI34NPtfPOAzaCJYNfj/O1Bd
eADeD8IJia8Uvi0=
-----END CERTIFICATE-----

2020-04-06 10:04:39,618 - DEBUG - Event triggered: ssl_cert
2020-04-06 10:04:39,623 - ERROR - day is out of range for month
Traceback (most recent call last):
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
if not self.__read_xml():
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
self.__spawn_event(xml)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
handler.prerun(stanza_copy)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
self.run(payload, True)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
self._pointer(payload)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
if self.xmpp.start_tls():
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
cert.verify(self._expected_server_name, self._der_cert)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/cert.py", line 133, in verify
not_before, not_after = extract_dates(raw_cert)
File "/home/admin1/.local/lib/python2.7/site-packages/sleekxmpp/xmlstream/cert.py", line 115, in extract_dates
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
File "/usr/lib/python2.7/_strptime.py", line 458, in _strptime
datetime_date(year, 1, 1).toordinal() + 1
ValueError: day is out of range for month
2020-04-06 10:04:39,625 - DEBUG - reconnecting...
2020-04-06 10:04:39,625 - DEBUG - Event triggered: session_end
2020-04-06 10:04:39,625 - DEBUG - SEND (IMMED): </stream:stream>
2020-04-06 10:04:39,626 - INFO - Waiting for </stream:stream> from server
^C
Aborted!

# Fixed code
def send(self, body, title="", notify_type=NotifyType.INFO, **kwargs):
    """
    Perform XMPP Notification
    """

    if not self._enabled:
        self.logger.warning(
            "XMPP Notifications are not supported by this system "
            "- install sleekxmpp or slixmpp."
        )
        return False

    # Detect our JID if it isn't otherwise specified
    jid = self.jid
    password = self.password
    if not jid:
        if self.user and self.password:
            # xmpp://user:password@hostname
            jid = "{}@{}".format(self.user, self.host)

        else:
            # xmpp://password@hostname
            jid = self.host
            password = self.password if self.password else self.user

    # Compute port number
    if not self.port:
        port = self.default_secure_port if self.secure else self.default_unsecure_port

    else:
        port = self.port

    try:
        # Communicate with XMPP.
        xmpp_adapter = self._adapter(
            host=self.host,
            port=port,
            secure=self.secure,
            verify_certificate=self.verify_certificate,
            xep=self.xep,
            jid=jid,
            password=password,
            body=body,
            targets=self.targets,
            before_message=self.throttle,
            logger=self.logger,
        )

    except ValueError:
        # We failed
        return False

    # Initialize XMPP machinery and begin processing the XML stream.
    outcome = xmpp_adapter.process()

    return outcome