'Play a piece of media.'

def play_media(self, media_type, media_id, **kwargs):

    if (not (self.device and ('playback' in self._device_protocol_capabilities))):
        return
    src = json.loads(media_id)
    media = None
    if (media_type == 'MUSIC'):
        media = self.device.server.library.section(src['library_name']).get(src['artist_name']).album(src['album_name']).get(src['track_name'])
    elif (media_type == 'EPISODE'):
        media = self._get_tv_media(src['library_name'], src['show_name'], src['season_number'], src['episode_number'])
    elif (media_type == 'PLAYLIST'):
        media = self.device.server.playlist(src['playlist_name'])
    elif (media_type == 'VIDEO'):
        media = self.device.server.library.section(src['library_name']).get(src['video_name'])
    import plexapi.playlist
    if (media and (media_type == 'EPISODE') and isinstance(media, plexapi.playlist.Playlist)):
        self._client_play_media(media=media, delete=True, shuffle=src['shuffle'])
    elif media:
        self._client_play_media(media=media, shuffle=src['shuffle'])
