'Instruct Plex client to play a piece of media.'

def _client_play_media(self, media, delete=False, **params):

    if (not (self.device and ('playback' in self._device_protocol_capabilities))):
        _LOGGER.error('Client    cannot    play    media:    %s', self.entity_id)
        return
    import plexapi.playqueue
    playqueue = plexapi.playqueue.PlayQueue.create(self.device.server, media, **params)
    if delete:
        media.delete()
    self._local_client_control_fix()
    server_url = self.device.server.baseurl.split(':')
    self.device.sendCommand('playback/playMedia', **dict({'machineIdentifier': self.device.server.machineIdentifier, 'address': server_url[1].strip('/'), 'port': server_url[(-1)], 'key': media.key, 'containerKey': '/playQueues/{}?window=100&own=1'.format(playqueue.playQueueID)}, **params))
