def play_media(self, media_type, media_id, **kwargs):
    'Play a piece of media.'
    _LOGGER.debug(('Starting media with media_id: ' + str(media_id)))
    if re.match('http://', str(media_id)):
        _LOGGER.debug('Playing URL %s', str(media_id))
        self._device.play_url(str(media_id))
    else:
        presets = self._device.presets()
        preset = next([preset for preset in presets if (preset.preset_id == str(media_id))].__iter__(), None)
        if (preset is not None):
            _LOGGER.debug(('Playing preset: ' + preset.name))
            self._device.select_preset(preset)
        else:
            _LOGGER.warning(('Unable to find preset with id ' + str(media_id)))
Play a piece of media.
def play_media(self, media_type, media_id, **kwargs):
    
    _LOGGER.debug(('Starting media with media_id: ' + str(media_id)))
    if re.match('http://', str(media_id)):
        _LOGGER.debug('Playing URL %s', str(media_id))
        self._device.play_url(str(media_id))
    else:
        presets = self._device.presets()
        preset = next([preset for preset in presets if (preset.preset_id == str(media_id))].__iter__(), None)
        if (preset is not None):
            _LOGGER.debug(('Playing preset: ' + preset.name))
            self._device.select_preset(preset)
        else:
            _LOGGER.warning(('Unable to find preset with id ' + str(media_id)))