def decode(self, response, request):
        """
        Parse the base64-encoded, colon-separated username and password into a
        L{credentials.UsernamePassword} instance.
        """
        try:
            creds = binascii.a2b_base64(response + b'===')
        except binascii.Error:
            raise error.LoginFailed('Invalid credentials')

        creds = creds.split(b':', 1)
        if len(creds) == 2:
            return credentials.UsernamePassword(*creds)
        else:
            raise error.LoginFailed('Invalid credentials')

        Parse the base64-encoded, colon-separated username and password into a
        L{credentials.UsernamePassword} instance.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_auth/basic.py