Analyze general tone.

        Use the general purpose endpoint to analyze the tone of your input content. The
        service analyzes the content for emotional and language tones. The method always
        analyzes the tone of the full document; by default, it also analyzes the tone of
        each individual sentence of the content.
        You can submit no more than 128 KB of total input content and no more than 1000
        individual sentences in JSON, plain text, or HTML format. The service analyzes the
        first 1000 sentences for document-level analysis and only the first 100 sentences
        for sentence-level analysis.
        Per the JSON specification, the default character encoding for JSON content is
        effectively always UTF-8; per the HTTP specification, the default encoding for
        plain text and HTML is ISO-8859-1 (effectively, the ASCII character set). When
        specifying a content type of plain text or HTML, include the `charset` parameter
        to indicate the character encoding of the input text; for example: `Content-Type:
        text/plain;charset=utf-8`. For `text/html`, the service removes HTML tags and
        analyzes only the textual content.
        **See also:** [Using the general-purpose
        endpoint](https://cloud.ibm.com/docs/services/tone-analyzer/using-tone.html#using-the-general-purpose-endpoint).

        :param ToneInput tone_input: JSON, plain text, or HTML input that contains the
        content to be analyzed. For JSON input, provide an object of type `ToneInput`.
        :param bool sentences: Indicates whether the service is to return an analysis of
        each individual sentence in addition to its analysis of the full document. If
        `true` (the default), the service returns results for each sentence.
        :param list[str] tones: **`2017-09-21`:** Deprecated. The service continues to
        accept the parameter for backward-compatibility, but the parameter no longer
        affects the response.
        **`2016-05-19`:** A comma-separated list of tones for which the service is to
        return its analysis of the input; the indicated tones apply both to the full
        document and to individual sentences of the document. You can specify one or more
        of the valid values. Omit the parameter to request results for all three tones.
        :param str content_language: The language of the input text for the request:
        English or French. Regional variants are treated as their parent language; for
        example, `en-US` is interpreted as `en`. The input content must match the
        specified language. Do not submit content that contains both languages. You can
        use different languages for **Content-Language** and **Accept-Language**.
        * **`2017-09-21`:** Accepts `en` or `fr`.
        * **`2016-05-19`:** Accepts only `en`.
        :param str accept_language: The desired language of the response. For
        two-character arguments, regional variants are treated as their parent language;
        for example, `en-US` is interpreted as `en`. You can use different languages for
        **Content-Language** and **Accept-Language**.
        :param str content_type: The type of the input. A character encoding can be
        specified by including a `charset` parameter. For example,
        'text/plain;charset=utf-8'.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse

def tone(self,
             tone_input,
             sentences=None,
             tones=None,
             content_language=None,
             accept_language=None,
             content_type=None,
             **kwargs):
        """
        Analyze general tone.

        Use the general purpose endpoint to analyze the tone of your input content. The
        service analyzes the content for emotional and language tones. The method always
        analyzes the tone of the full document; by default, it also analyzes the tone of
        each individual sentence of the content.
        You can submit no more than 128 KB of total input content and no more than 1000
        individual sentences in JSON, plain text, or HTML format. The service analyzes the
        first 1000 sentences for document-level analysis and only the first 100 sentences
        for sentence-level analysis.
        Per the JSON specification, the default character encoding for JSON content is
        effectively always UTF-8; per the HTTP specification, the default encoding for
        plain text and HTML is ISO-8859-1 (effectively, the ASCII character set). When
        specifying a content type of plain text or HTML, include the `charset` parameter
        to indicate the character encoding of the input text; for example: `Content-Type:
        text/plain;charset=utf-8`. For `text/html`, the service removes HTML tags and
        analyzes only the textual content.
        **See also:** [Using the general-purpose
        endpoint](https://cloud.ibm.com/docs/services/tone-analyzer/using-tone.html#using-the-general-purpose-endpoint).

        :param ToneInput tone_input: JSON, plain text, or HTML input that contains the
        content to be analyzed. For JSON input, provide an object of type `ToneInput`.
        :param bool sentences: Indicates whether the service is to return an analysis of
        each individual sentence in addition to its analysis of the full document. If
        `true` (the default), the service returns results for each sentence.
        :param list[str] tones: **`2017-09-21`:** Deprecated. The service continues to
        accept the parameter for backward-compatibility, but the parameter no longer
        affects the response.
        **`2016-05-19`:** A comma-separated list of tones for which the service is to
        return its analysis of the input; the indicated tones apply both to the full
        document and to individual sentences of the document. You can specify one or more
        of the valid values. Omit the parameter to request results for all three tones.
        :param str content_language: The language of the input text for the request:
        English or French. Regional variants are treated as their parent language; for
        example, `en-US` is interpreted as `en`. The input content must match the
        specified language. Do not submit content that contains both languages. You can
        use different languages for **Content-Language** and **Accept-Language**.
        * **`2017-09-21`:** Accepts `en` or `fr`.
        * **`2016-05-19`:** Accepts only `en`.
        :param str accept_language: The desired language of the response. For
        two-character arguments, regional variants are treated as their parent language;
        for example, `en-US` is interpreted as `en`. You can use different languages for
        **Content-Language** and **Accept-Language**.
        :param str content_type: The type of the input. A character encoding can be
        specified by including a `charset` parameter. For example,
        'text/plain;charset=utf-8'.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if tone_input is None:
            raise ValueError('tone_input must be provided')
        if isinstance(tone_input, ToneInput):
            tone_input = self._convert_model(tone_input, ToneInput)

        headers = {
            'Content-Language': content_language,
            'Accept-Language': accept_language,
            'Content-Type': content_type
        }
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('tone_analyzer', 'V3', 'tone')
        headers.update(sdk_headers)

        params = {
            'version': self.version,
            'sentences': sentences,
            'tones': self._convert_list(tones)
        }

        if content_type == 'application/json' and isinstance(tone_input, dict):
            data = json.dumps(tone_input)
        else:
            data = tone_input

        url = '/v3/tone'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            data=data,
            accept_json=True)
        return response