def set_option(self, key, value):
        """Sets a option for this session.

        For a detailed list of available options see the librtmp(3) man page.

        :param key: str, A valid option key.
        :param value: A value, anything that can be converted to str is valid.

        Raises :exc:`ValueError` if a invalid option is specified.

        """

        akey = AVal(key)
        aval = AVal(value)

        res = librtmp.RTMP_SetOpt(self.rtmp, akey.aval, aval.aval)

        if res < 1:
            raise ValueError("Unable to set option {0}".format(key))

        self._options[akey] = aval