'Sends a Telegram notification
:param title: The title of the notification to send
:param msg: The message string to send
:param id: The Telegram user/group id to send the message to
:param api_key: Your Telegram bot API token
:returns: True if the message succeeded, False otherwise'

def _send_telegram_msg(self, title, msg, id=None, api_key=None):

    id = (sickbeard.TELEGRAM_ID if (id is None) else id)
    api_key = (sickbeard.TELEGRAM_APIKEY if (api_key is None) else api_key)
    logger.log(u'Telegram    in    use    with    API    KEY:    {0}'.format(api_key), logger.DEBUG)
    message = u'{0}    :    {1}'.format(title.encode(), msg.encode())
    payload = urllib.parse.urlencode({u'chat_id': id, u'text': message})
    telegram_api = u'https://api.telegram.org/bot%s/%s'
    req = urllib.request.Request((telegram_api % (api_key, u'sendMessage')), payload)
    success = False
    try:
        urllib.request.urlopen(req)
        message = u'Telegram    message    sent    successfully.'
        success = True
    except IOError as e:
        message = u'Unknown    IO    error:    {0}'.format(e)
        if hasattr(e, 'code'):
            error_message = {400: u'Missing    parameter(s).    Double    check    your    settings    or    if    the    channel/user    exists.', 401: u'Authentication    failed.', 420: u'Too    many    messages.', 500: u'Server    error.    Please    retry    in    a    few    moments.'}
            if (e.code in error_message):
                message = error_message.get(e.code)
            else:
                HTTP_STATUS_CODES.get(e.code, message)
    except Exception as e:
        message = u'Error    while    sending    Telegram    message:    {0}    '.format(e)
    finally:
        logger.log(message, logger.INFO)
        return (success, message)
