def rename_channel(self, name, new_name):
        '''Renames a channel.

        Parameters
        ----------
        name: str
            name of the channel that should be renamed
        new_name: str
            name that should be given to the channel

        See also
        --------
        :func:`tmserver.api.channel.update_channel`
        :class:`tmlib.models.channel.Channel`
        '''
        logger.info(
            'rename channel "%s" of experiment "%s"',
            name, self.experiment_name
        )
        channel_id = self._get_channel_id(name)
        content = {'name': new_name}
        url = self._build_api_url(
            '/experiments/{experiment_id}/channels/{channel_id}'.format(
                experiment_id=self._experiment_id, channel_id=channel_id
            )
        )
        res = self._session.put(url, json=content)
        res.raise_for_status()