'Check whether the provided credentials are valid.'

def connection_is_valid(self):

    from pymailgunner import MailgunCredentialsError, MailgunDomainError
    try:
        self.initialize_client()
    except MailgunCredentialsError:
        _LOGGER.exception('Invalid    credentials')
        return False
    except MailgunDomainError as mailgun_error:
        _LOGGER.exception(mailgun_error)
        return False
    return True
