'Send a message to a Android TV device.'

def send_message(self, message='', **kwargs):

    _LOGGER.debug('Sending    notification    to:    %s', self._target)
    payload = dict(filename=('icon.png', open(self._icon_file, 'rb'), 'application/octet-stream', {'Expires': '0'}), type='0', title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT), msg=message, duration=('%i' % self._default_duration), position=('%i' % POSITIONS.get(self._default_position)), bkgcolor=('%s' % COLORS.get(self._default_color)), transparency=('%i' % TRANSPARENCIES.get(self._default_transparency)), offset='0', app=ATTR_TITLE_DEFAULT, force='true', interrupt=('%i' % self._default_interrupt))
    data = kwargs.get(ATTR_DATA)
    if data:
        if (ATTR_DURATION in data):
            duration = data.get(ATTR_DURATION)
            try:
                payload[ATTR_DURATION] = ('%i' % int(duration))
            except ValueError:
                _LOGGER.warning('Invalid    duration-value:    %s', str(duration))
        if (ATTR_POSITION in data):
            position = data.get(ATTR_POSITION)
            if (position in POSITIONS):
                payload[ATTR_POSITION] = ('%i' % POSITIONS.get(position))
            else:
                _LOGGER.warning('Invalid    position-value:    %s', str(position))
        if (ATTR_TRANSPARENCY in data):
            transparency = data.get(ATTR_TRANSPARENCY)
            if (transparency in TRANSPARENCIES):
                payload[ATTR_TRANSPARENCY] = ('%i' % TRANSPARENCIES.get(transparency))
            else:
                _LOGGER.warning('Invalid    transparency-value:    %s', str(transparency))
        if (ATTR_COLOR in data):
            color = data.get(ATTR_COLOR)
            if (color in COLORS):
                payload[ATTR_BKGCOLOR] = ('%s' % COLORS.get(color))
            else:
                _LOGGER.warning('Invalid    color-value:    %s', str(color))
        if (ATTR_INTERRUPT in data):
            interrupt = data.get(ATTR_INTERRUPT)
            try:
                payload[ATTR_INTERRUPT] = ('%i' % cv.boolean(interrupt))
            except vol.Invalid:
                _LOGGER.warning('Invalid    interrupt-value:    %s', str(interrupt))
    try:
        _LOGGER.debug('Payload:    %s', str(payload))
        response = requests.post(self._target, files=payload, timeout=self._timeout)
        if (response.status_code != 200):
            _LOGGER.error('Error    sending    message:    %s', str(response))
    except requests.exceptions.ConnectionError as err:
        _LOGGER.error('Error    communicating    with    %s:    %s', self._target, str(err))
