def METHOD_NAME(image, **kwargs):
    assert 'message' in kwargs
    url = urljoin(PUSHOVER_API, "messages.json")
    headers = { 'User-Agent': 'mqttwarn' }
    if image:
        attachment = { "attachment": ( "image.jpg", image, "image/jpeg" )}
        r = requests.post(url, data=kwargs, files=attachment, headers=headers)
    else:
        r = requests.post(url, data=kwargs, headers=headers)
    if r.json()['status'] != 1:
        raise PushoverError(r.content)