'Sends a pushover notification to the address provided
msg: The message to send (unicode)
title: The title of the message
sound: The notification sound to use
userKey: The pushover user id to send the message to (or to subscribe with)
apiKey: The pushover api key to use
returns: True if the message succeeded, False otherwise'

def _sendPushover(self, msg, title, sound=None, userKey=None, apiKey=None):

    if (userKey is None):
        userKey = sickrage.srCore.srConfig.PUSHOVER_USERKEY
    if (apiKey is None):
        apiKey = sickrage.srCore.srConfig.PUSHOVER_APIKEY
    if (sound is None):
        sound = sickrage.srCore.srConfig.PUSHOVER_SOUND
    sickrage.srCore.srLogger.debug((u'Pushover    API    KEY    in    use:    ' + apiKey))
    msg = msg.strip()
    try:
        if (sickrage.srCore.srConfig.PUSHOVER_SOUND != u'default'):
            args = {u'token': apiKey, u'user': userKey, u'title': title.encode(u'utf-8'), u'message': msg.encode(u'utf-8'), u'timestamp': int(time.time()), u'retry': 60, u'expire': 3600, u'sound': sound}
        else:
            args = {u'token': apiKey, u'user': userKey, u'title': title.encode(u'utf-8'), u'message': msg.encode(u'utf-8'), u'timestamp': int(time.time()), u'retry': 60, u'expire': 3600}
        if sickrage.srCore.srConfig.PUSHOVER_DEVICE:
            args[u'device'] = sickrage.srCore.srConfig.PUSHOVER_DEVICE
        conn = httplib.HTTPSConnection(u'api.pushover.net:443')
        conn.request(u'POST', u'/1/messages.json', urllib.urlencode(args), {u'Content-type': u'application/x-www-form-urlencoded'})
    except urllib2.HTTPError as e:
        if (not hasattr(e, u'code')):
            sickrage.srCore.srLogger.error(u'Pushover    notification    failed.{}'.format(e.message))
            return False
        else:
            sickrage.srCore.srLogger.error((u'Pushover    notification    failed.    Error    code:    ' + str(e.code)))
        if (e.code == 404):
            sickrage.srCore.srLogger.warning(u'Username    is    wrong/not    a    pushover    email.    Pushover    will    send    an    email    to    it')
            return False
        elif (e.code == 401):
            subscribeNote = self._sendPushover(msg, title, sound=sound, userKey=userKey, apiKey=apiKey)
            if subscribeNote:
                sickrage.srCore.srLogger.debug(u'Subscription    sent')
                return True
            else:
                sickrage.srCore.srLogger.error(u'Subscription    could    not    be    sent')
                return False
        elif (e.code == 400):
            sickrage.srCore.srLogger.error(u'Wrong    data    sent    to    pushover')
            return False
        elif (e.code == 429):
            sickrage.srCore.srLogger.error(u'Pushover    API    message    limit    reached    -    try    a    different    API    key')
            return False
    sickrage.srCore.srLogger.info(u'Pushover    notification    successful.')
    return True
