Instruction:
Write a Python 3 script for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'recognitions') and self.recognitions is not None:
            _dict['recognitions'] = [x._to_dict() for x in self.recognitions]
        return _dict


Instruction:
Implement a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'url') and self.url is not None:
            _dict['url'] = self.url
        return _dict


Instruction:
Can you generate the documentation for the following Python 3 function
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'from_') and self.from_ is not None:
            _dict['from'] = self.from_
        if hasattr(self, 'to') and self.to is not None:
            _dict['to'] = self.to
        if hasattr(self, 'speaker') and self.speaker is not None:
            _dict['speaker'] = self.speaker
        if hasattr(self, 'confidence') and self.confidence is not None:
            _dict['confidence'] = self.confidence
        if hasattr(self, 'final_results') and self.final_results is not None:
            _dict['final'] = self.final_results
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'rate') and self.rate is not None:
            _dict['rate'] = self.rate
        if hasattr(self, 'url') and self.url is not None:
            _dict['url'] = self.url
        if hasattr(
                self,
                'supported_features') and self.supported_features is not None:
            _dict['supported_features'] = self.supported_features._to_dict()
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        return _dict


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'models' in _dict:
            args['models'] = [
                SpeechModel._from_dict(x) for x in (_dict.get('models'))
            ]
        else:
            raise ValueError(
                'Required property \'models\' not present in SpeechModels JSON')
        return cls(**args)

Response: Initialize a SpeechModels object from a json dictionary.


Instruction:
Implement a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'transcript') and self.transcript is not None:
            _dict['transcript'] = self.transcript
        if hasattr(self, 'confidence') and self.confidence is not None:
            _dict['confidence'] = self.confidence
        if hasattr(self, 'timestamps') and self.timestamps is not None:
            _dict['timestamps'] = self.timestamps
        if hasattr(self,
                   'word_confidence') and self.word_confidence is not None:
            _dict['word_confidence'] = self.word_confidence
        return _dict


Instruction:
How would you code a function in Python 3 to
initialize a SpeechRecognitionResult object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a SpeechRecognitionResult object from a json dictionary."""
        args = {}
        if 'final' in _dict or 'final_results' in _dict:
            args['final_results'] = _dict.get('final') or _dict.get(
                'final_results')
        else:
            raise ValueError(
                'Required property \'final\' not present in SpeechRecognitionResult JSON'
            )
        if 'alternatives' in _dict:
            args['alternatives'] = [
                SpeechRecognitionAlternative._from_dict(x)
                for x in (_dict.get('alternatives'))
            ]
        else:
            raise ValueError(
                'Required property \'alternatives\' not present in SpeechRecognitionResult JSON'
            )
        if 'keywords_result' in _dict:
            args['keywords_result'] = _dict.get('keywords_result')
        if 'word_alternatives' in _dict:
            args['word_alternatives'] = [
                WordAlternativeResults._from_dict(x)
                for x in (_dict.get('word_alternatives'))
            ]
        return cls(**args)


Instruction:
Make a summary of the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'final_results') and self.final_results is not None:
            _dict['final'] = self.final_results
        if hasattr(self, 'alternatives') and self.alternatives is not None:
            _dict['alternatives'] = [x._to_dict() for x in self.alternatives]
        if hasattr(self,
                   'keywords_result') and self.keywords_result is not None:
            _dict['keywords_result'] = self.keywords_result
        if hasattr(self,
                   'word_alternatives') and self.word_alternatives is not None:
            _dict['word_alternatives'] = [
                x._to_dict() for x in self.word_alternatives
            ]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a Python 3 function for
initializing a SpeechRecognitionResults object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a SpeechRecognitionResults object from a json dictionary."""
        args = {}
        if 'results' in _dict:
            args['results'] = [
                SpeechRecognitionResult._from_dict(x)
                for x in (_dict.get('results'))
            ]
        if 'result_index' in _dict:
            args['result_index'] = _dict.get('result_index')
        if 'speaker_labels' in _dict:
            args['speaker_labels'] = [
                SpeakerLabelsResult._from_dict(x)
                for x in (_dict.get('speaker_labels'))
            ]
        if 'warnings' in _dict:
            args['warnings'] = _dict.get('warnings')
        return cls(**args)


Instruction:
Can you create a Python 3 function that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'results') and self.results is not None:
            _dict['results'] = [x._to_dict() for x in self.results]
        if hasattr(self, 'result_index') and self.result_index is not None:
            _dict['result_index'] = self.result_index
        if hasattr(self, 'speaker_labels') and self.speaker_labels is not None:
            _dict['speaker_labels'] = [
                x._to_dict() for x in self.speaker_labels
            ]
        if hasattr(self, 'warnings') and self.warnings is not None:
            _dict['warnings'] = self.warnings
        return _dict


Instruction:
Can you implement a function in Python 3 that
initializes a SupportedFeatures object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a SupportedFeatures object from a json dictionary."""
        args = {}
        if 'custom_language_model' in _dict:
            args['custom_language_model'] = _dict.get('custom_language_model')
        else:
            raise ValueError(
                'Required property \'custom_language_model\' not present in SupportedFeatures JSON'
            )
        if 'speaker_labels' in _dict:
            args['speaker_labels'] = _dict.get('speaker_labels')
        else:
            raise ValueError(
                'Required property \'speaker_labels\' not present in SupportedFeatures JSON'
            )
        return cls(**args)


Instruction:
Implement a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'custom_language_model'
                  ) and self.custom_language_model is not None:
            _dict['custom_language_model'] = self.custom_language_model
        if hasattr(self, 'speaker_labels') and self.speaker_labels is not None:
            _dict['speaker_labels'] = self.speaker_labels
        return _dict


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'word' in _dict:
            args['word'] = _dict.get('word')
        else:
            raise ValueError(
                'Required property \'word\' not present in Word JSON')
        if 'sounds_like' in _dict:
            args['sounds_like'] = _dict.get('sounds_like')
        else:
            raise ValueError(
                'Required property \'sounds_like\' not present in Word JSON')
        if 'display_as' in _dict:
            args['display_as'] = _dict.get('display_as')
        else:
            raise ValueError(
                'Required property \'display_as\' not present in Word JSON')
        if 'count' in _dict:
            args['count'] = _dict.get('count')
        else:
            raise ValueError(
                'Required property \'count\' not present in Word JSON')
        if 'source' in _dict:
            args['source'] = _dict.get('source')
        else:
            raise ValueError(
                'Required property \'source\' not present in Word JSON')
        if 'error' in _dict:
            args['error'] = [
                WordError._from_dict(x) for x in (_dict.get('error'))
            ]
        return cls(**args)

Response: Initialize a Word object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'word') and self.word is not None:
            _dict['word'] = self.word
        if hasattr(self, 'sounds_like') and self.sounds_like is not None:
            _dict['sounds_like'] = self.sounds_like
        if hasattr(self, 'display_as') and self.display_as is not None:
            _dict['display_as'] = self.display_as
        if hasattr(self, 'count') and self.count is not None:
            _dict['count'] = self.count
        if hasattr(self, 'source') and self.source is not None:
            _dict['source'] = self.source
        if hasattr(self, 'error') and self.error is not None:
            _dict['error'] = [x._to_dict() for x in self.error]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'confidence') and self.confidence is not None:
            _dict['confidence'] = self.confidence
        if hasattr(self, 'word') and self.word is not None:
            _dict['word'] = self.word
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you tell what is the following Python 3 function doing
def _from_dict(cls, _dict):
        args = {}
        if 'start_time' in _dict:
            args['start_time'] = _dict.get('start_time')
        else:
            raise ValueError(
                'Required property \'start_time\' not present in WordAlternativeResults JSON'
            )
        if 'end_time' in _dict:
            args['end_time'] = _dict.get('end_time')
        else:
            raise ValueError(
                'Required property \'end_time\' not present in WordAlternativeResults JSON'
            )
        if 'alternatives' in _dict:
            args['alternatives'] = [
                WordAlternativeResult._from_dict(x)
                for x in (_dict.get('alternatives'))
            ]
        else:
            raise ValueError(
                'Required property \'alternatives\' not present in WordAlternativeResults JSON'
            )
        return cls(**args)

Response: Initialize a WordAlternativeResults object from a json dictionary.


Instruction:
Can you generate the documentation for the following Python 3 function
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'start_time') and self.start_time is not None:
            _dict['start_time'] = self.start_time
        if hasattr(self, 'end_time') and self.end_time is not None:
            _dict['end_time'] = self.end_time
        if hasattr(self, 'alternatives') and self.alternatives is not None:
            _dict['alternatives'] = [x._to_dict() for x in self.alternatives]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'element') and self.element is not None:
            _dict['element'] = self.element
        return _dict


Instruction:
Can you tell what is the following Python 3 function doing
def _from_dict(cls, _dict):
        args = {}
        if 'words' in _dict:
            args['words'] = [Word._from_dict(x) for x in (_dict.get('words'))]
        else:
            raise ValueError(
                'Required property \'words\' not present in Words JSON')
        return cls(**args)

Response: Initialize a Words object from a json dictionary.


Instruction:
How would you explain what the following Python 3 function does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'words') and self.words is not None:
            _dict['words'] = [x._to_dict() for x in self.words]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Write a Python 3 function that can
update the user emotion tone with the primary emotion

Response:
def updateEmotionTone(user, emotionTone, maintainHistory):
    """
    updateEmotionTone updates the user emotion tone with the primary emotion -
    the emotion tone that has a score greater than or equal to the
    EMOTION_SCORE_THRESHOLD; otherwise primary emotion will be 'neutral'
    @param user a json object representing user information (tone) to be used in
    conversing with the Conversation Service
    @param emotionTone a json object containing the emotion tones in the payload
    returned by the Tone Analyzer
    """
    maxScore = 0.0
    primaryEmotion = None
    primaryEmotionScore = None

    for tone in emotionTone['tones']:
        if tone['score'] > maxScore:
            maxScore = tone['score']
            primaryEmotion = tone['tone_name'].lower()
            primaryEmotionScore = tone['score']

    if maxScore <= PRIMARY_EMOTION_SCORE_THRESHOLD:
        primaryEmotion = 'neutral'
        primaryEmotionScore = None

    # update user emotion tone
    user['tone']['emotion']['current'] = primaryEmotion

    if maintainHistory:
        if 'history' not in user['tone']['emotion']:
            user['tone']['emotion']['history'] = []
            user['tone']['emotion']['history'].append({
                'tone_name': primaryEmotion,
                'score': primaryEmotionScore
            })


Instruction:
Can you write a function in Python 3 where it
updates the user with the writing tones interpreted based on the specified thresholds.

Response:
def updateWritingTone(user, writingTone, maintainHistory):
    """
    updateWritingTone updates the user with the writing tones interpreted based
    on the specified thresholds
    @param: user a json object representing user information (tone) to be used
    in conversing with the Conversation Service
    @param: writingTone a json object containing the writing tones in the
    payload returned by the Tone Analyzer
    """
    currentWriting = []
    currentWritingObject = []

    # Process each writing tone and determine if it is high or low
    for tone in writingTone['tones']:
        if tone['score'] >= WRITING_HIGH_SCORE_THRESHOLD:
            currentWriting.append(tone['tone_name'].lower() + '_high')
            currentWritingObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'likely high'
            })
        elif tone['score'] <= WRITING_NO_SCORE_THRESHOLD:
            currentWritingObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'no evidence'
            })
        else:
            currentWritingObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'likely medium'
            })

    # update user writing tone
    user['tone']['writing']['current'] = currentWriting
    if maintainHistory:
        if 'history' not in user['tone']['writing']:
            user['tone']['writing']['history'] = []
    user['tone']['writing']['history'].append(currentWritingObject)


Instruction:
Can you write a function in Python 3 where it
updates the user with the social tones interpreted based on the specified thresholds.

Response:
def updateSocialTone(user, socialTone, maintainHistory):
    """
    updateSocialTone updates the user with the social tones interpreted based on
    the specified thresholds
    @param user a json object representing user information (tone) to be used in
    conversing with the Conversation Service
    @param socialTone a json object containing the social tones in the payload
    returned by the Tone Analyzer
    """
    currentSocial = []
    currentSocialObject = []

    # Process each social tone and determine if it is high or low
    for tone in socialTone['tones']:
        if tone['score'] >= SOCIAL_HIGH_SCORE_THRESHOLD:
            currentSocial.append(tone['tone_name'].lower() + '_high')
            currentSocialObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'likely high'
            })
        elif tone['score'] <= SOCIAL_LOW_SCORE_THRESHOLD:
            currentSocial.append(tone['tone_name'].lower() + '_low')
            currentSocialObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'likely low'
            })
        else:
            currentSocialObject.append({
                'tone_name': tone['tone_name'].lower(),
                'score': tone['score'],
                'interpretation': 'likely medium'
            })

    # update user social tone
    user['tone']['social']['current'] = currentSocial
    if maintainHistory:
        if not user['tone']['social']['current']:
            user['tone']['social']['current'] = []
        user['tone']['social']['current'].append(currentSocialObject)


Instruction:
How would you implement a function in Python 3 that
synthesizes a text to audio.

Response:
def synthesize(self,
                   text,
                   voice=None,
                   customization_id=None,
                   accept=None,
                   **kwargs):
        """
        Synthesize audio.

        Synthesizes text to audio that is spoken in the specified voice. The service bases
        its understanding of the language for the input text on the specified voice. Use a
        voice that matches the language of the input text.
        The method accepts a maximum of 5 KB of input text in the body of the request, and
        8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you
        specify. The service returns the synthesized audio stream as an array of bytes.
        **See also:** [The HTTP
        interface](https://cloud.ibm.com/docs/services/text-to-speech/http.html).
        ### Audio formats (accept types)
         The service can return audio in the following formats (MIME types).
        * Where indicated, you can optionally specify the sampling rate (`rate`) of the
        audio. You must specify a sampling rate for the `audio/l16` and `audio/mulaw`
        formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz.
        * For the `audio/l16` format, you can optionally specify the endianness
        (`endianness`) of the audio: `endianness=big-endian` or
        `endianness=little-endian`.
        Use the `Accept` header or the `accept` parameter to specify the requested format
        of the response audio. If you omit an audio format altogether, the service returns
        the audio in Ogg format with the Opus codec (`audio/ogg;codecs=opus`). The service
        always returns single-channel audio.
        * `audio/basic`
          The service returns audio with a sampling rate of 8000 Hz.
        * `audio/flac`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/l16`
          You must specify the `rate` of the audio. You can optionally specify the
        `endianness` of the audio. The default endianness is `little-endian`.
        * `audio/mp3`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/mpeg`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/mulaw`
          You must specify the `rate` of the audio.
        * `audio/ogg`
          The service returns the audio in the `vorbis` codec. You can optionally specify
        the `rate` of the audio. The default sampling rate is 22,050 Hz.
        * `audio/ogg;codecs=opus`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/ogg;codecs=vorbis`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/wav`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        * `audio/webm`
          The service returns the audio in the `opus` codec. The service returns audio
        with a sampling rate of 48,000 Hz.
        * `audio/webm;codecs=opus`
          The service returns audio with a sampling rate of 48,000 Hz.
        * `audio/webm;codecs=vorbis`
          You can optionally specify the `rate` of the audio. The default sampling rate is
        22,050 Hz.
        For more information about specifying an audio format, including additional
        details about some of the formats, see [Audio
        formats](https://cloud.ibm.com/docs/services/text-to-speech/audio-formats.html).
        ### Warning messages
         If a request includes invalid query parameters, the service returns a `Warnings`
        response header that provides messages about the invalid parameters. The warning
        includes a descriptive message and a list of invalid argument strings. For
        example, a message such as `\"Unknown arguments:\"` or `\"Unknown url query
        arguments:\"` followed by a list of the form `\"{invalid_arg_1},
        {invalid_arg_2}.\"` The request succeeds despite the warnings.

        :param str text: The text to synthesize.
        :param str voice: The voice to use for synthesis.
        :param str customization_id: The customization ID (GUID) of a custom voice model
        to use for the synthesis. If a custom voice model is specified, it is guaranteed
        to work only if it matches the language of the indicated voice. You must make the
        request with service credentials created for the instance of the service that owns
        the custom model. Omit the parameter to use the specified voice with no
        customization.
        :param str accept: The requested format (MIME type) of the audio. You can use the
        `Accept` header or the `accept` parameter to specify the audio format. For more
        information about specifying an audio format, see **Audio formats (accept types)**
        in the method description.
        Default: `audio/ogg;codecs=opus`.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if text is None:
            raise ValueError('text must be provided')

        headers = {'Accept': accept}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('text_to_speech', 'V1', 'synthesize')
        headers.update(sdk_headers)

        params = {'voice': voice, 'customization_id': customization_id}

        data = {'text': text}

        url = '/v1/synthesize'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            json=data,
            accept_json=False)
        return response


Instruction:
Implement a function in Python 3 to
update the custom voice model with the specified customization ID name description and words.

Response:
def update_voice_model(self,
                           customization_id,
                           name=None,
                           description=None,
                           words=None,
                           **kwargs):
        """
        Update a custom model.

        Updates information for the specified custom voice model. You can update metadata
        such as the name and description of the voice model. You can also update the words
        in the model and their translations. Adding a new translation for a word that
        already exists in a custom model overwrites the word's existing translation. A
        custom model can contain no more than 20,000 entries. You must use credentials for
        the instance of the service that owns a model to update it.
        You can define sounds-like or phonetic translations for words. A sounds-like
        translation consists of one or more words that, when combined, sound like the
        word. Phonetic translations are based on the SSML phoneme format for representing
        a word. You can specify them in standard International Phonetic Alphabet (IPA)
        representation
          <phoneme alphabet=\"ipa\"
        ph=\"təmˈɑto\"></phoneme>
          or in the proprietary IBM Symbolic Phonetic Representation (SPR)
          <phoneme alphabet=\"ibm\"
        ph=\"1gAstroEntxrYFXs\"></phoneme>
        **Note:** This method is currently a beta release.
        **See also:**
        * [Updating a custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-models.html#cuModelsUpdate)
        * [Adding words to a Japanese custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
        * [Understanding
        customization](https://cloud.ibm.com/docs/services/text-to-speech/custom-intro.html).

        :param str customization_id: The customization ID (GUID) of the custom voice
        model. You must make the request with service credentials created for the instance
        of the service that owns the custom model.
        :param str name: A new name for the custom voice model.
        :param str description: A new description for the custom voice model.
        :param list[Word] words: An array of `Word` objects that provides the words and
        their translations that are to be added or updated for the custom voice model.
        Pass an empty array to make no additions or updates.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if customization_id is None:
            raise ValueError('customization_id must be provided')
        if words is not None:
            words = [self._convert_model(x, Word) for x in words]

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('text_to_speech', 'V1',
                                      'update_voice_model')
        headers.update(sdk_headers)

        data = {'name': name, 'description': description, 'words': words}

        url = '/v1/customizations/{0}'.format(
            *self._encode_path_vars(customization_id))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            json=data,
            accept_json=True)
        return response


Instruction:
Write a Python 3 script to
add a word to the specified custom model.

Response:
def add_word(self,
                 customization_id,
                 word,
                 translation,
                 part_of_speech=None,
                 **kwargs):
        """
        Add a custom word.

        Adds a single word and its translation to the specified custom voice model. Adding
        a new translation for a word that already exists in a custom model overwrites the
        word's existing translation. A custom model can contain no more than 20,000
        entries. You must use credentials for the instance of the service that owns a
        model to add a word to it.
        You can define sounds-like or phonetic translations for words. A sounds-like
        translation consists of one or more words that, when combined, sound like the
        word. Phonetic translations are based on the SSML phoneme format for representing
        a word. You can specify them in standard International Phonetic Alphabet (IPA)
        representation
          <phoneme alphabet=\"ipa\"
        ph=\"təmˈɑto\"></phoneme>
          or in the proprietary IBM Symbolic Phonetic Representation (SPR)
          <phoneme alphabet=\"ibm\"
        ph=\"1gAstroEntxrYFXs\"></phoneme>
        **Note:** This method is currently a beta release.
        **See also:**
        * [Adding a single word to a custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuWordAdd)
        * [Adding words to a Japanese custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
        * [Understanding
        customization](https://cloud.ibm.com/docs/services/text-to-speech/custom-intro.html).

        :param str customization_id: The customization ID (GUID) of the custom voice
        model. You must make the request with service credentials created for the instance
        of the service that owns the custom model.
        :param str word: The word that is to be added or updated for the custom voice
        model.
        :param str translation: The phonetic or sounds-like translation for the word. A
        phonetic translation is based on the SSML format for representing the phonetic
        string of a word either as an IPA translation or as an IBM SPR translation. A
        sounds-like is one or more words that, when combined, sound like the word.
        :param str part_of_speech: **Japanese only.** The part of speech for the word. The
        service uses the value to produce the correct intonation for the word. You can
        create only a single entry, with or without a single part of speech, for any word;
        you cannot create multiple entries with different parts of speech for the same
        word. For more information, see [Working with Japanese
        entries](https://cloud.ibm.com/docs/services/text-to-speech/custom-rules.html#jaNotes).
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if customization_id is None:
            raise ValueError('customization_id must be provided')
        if word is None:
            raise ValueError('word must be provided')
        if translation is None:
            raise ValueError('translation must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('text_to_speech', 'V1', 'add_word')
        headers.update(sdk_headers)

        data = {'translation': translation, 'part_of_speech': part_of_speech}

        url = '/v1/customizations/{0}/words/{1}'.format(
            *self._encode_path_vars(customization_id, word))
        response = self.request(
            method='PUT',
            url=url,
            headers=headers,
            json=data,
            accept_json=False)
        return response


Instruction:
Write a Python 3 function that can
delete labeled data. Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes the data. **See also:** [Information security](https://cloud.ibm.com/docs/services/text-to-speech/information-security.html). :param str customer_id: The customer ID for which all data is to be deleted. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse

Response:
def delete_user_data(self, customer_id, **kwargs):
        """
        Delete labeled data.

        Deletes all data that is associated with a specified customer ID. The method
        deletes all data for the customer ID, regardless of the method by which the
        information was added. The method has no effect if no data is associated with the
        customer ID. You must issue the request with credentials for the same instance of
        the service that was used to associate the customer ID with the data.
        You associate a customer ID with data by passing the `X-Watson-Metadata` header
        with a request that passes the data.
        **See also:** [Information
        security](https://cloud.ibm.com/docs/services/text-to-speech/information-security.html).

        :param str customer_id: The customer ID for which all data is to be deleted.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if customer_id is None:
            raise ValueError('customer_id must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('text_to_speech', 'V1',
                                      'delete_user_data')
        headers.update(sdk_headers)

        params = {'customer_id': customer_id}

        url = '/v1/user_data'
        response = self.request(
            method='DELETE',
            url=url,
            headers=headers,
            params=params,
            accept_json=False)
        return response


Instruction:
Write a Python 3 script for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'pronunciation') and self.pronunciation is not None:
            _dict['pronunciation'] = self.pronunciation
        return _dict


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'custom_pronunciation'
                  ) and self.custom_pronunciation is not None:
            _dict['custom_pronunciation'] = self.custom_pronunciation
        if hasattr(self, 'voice_transformation'
                  ) and self.voice_transformation is not None:
            _dict['voice_transformation'] = self.voice_transformation
        return _dict


Instruction:
Here you have a function in Python 3, explain what it does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'url') and self.url is not None:
            _dict['url'] = self.url
        if hasattr(self, 'gender') and self.gender is not None:
            _dict['gender'] = self.gender
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self, 'customizable') and self.customizable is not None:
            _dict['customizable'] = self.customizable
        if hasattr(
                self,
                'supported_features') and self.supported_features is not None:
            _dict['supported_features'] = self.supported_features._to_dict()
        if hasattr(self, 'customization') and self.customization is not None:
            _dict['customization'] = self.customization._to_dict()
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a function in Python 3 to
initialize a VoiceModel object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a VoiceModel object from a json dictionary."""
        args = {}
        if 'customization_id' in _dict:
            args['customization_id'] = _dict.get('customization_id')
        else:
            raise ValueError(
                'Required property \'customization_id\' not present in VoiceModel JSON'
            )
        if 'name' in _dict:
            args['name'] = _dict.get('name')
        if 'language' in _dict:
            args['language'] = _dict.get('language')
        if 'owner' in _dict:
            args['owner'] = _dict.get('owner')
        if 'created' in _dict:
            args['created'] = _dict.get('created')
        if 'last_modified' in _dict:
            args['last_modified'] = _dict.get('last_modified')
        if 'description' in _dict:
            args['description'] = _dict.get('description')
        if 'words' in _dict:
            args['words'] = [Word._from_dict(x) for x in (_dict.get('words'))]
        return cls(**args)


Instruction:
Here you have a function in Python 3, explain what it does
def _to_dict(self):
        _dict = {}
        if hasattr(self,
                   'customization_id') and self.customization_id is not None:
            _dict['customization_id'] = self.customization_id
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'owner') and self.owner is not None:
            _dict['owner'] = self.owner
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = self.created
        if hasattr(self, 'last_modified') and self.last_modified is not None:
            _dict['last_modified'] = self.last_modified
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self, 'words') and self.words is not None:
            _dict['words'] = [x._to_dict() for x in self.words]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'customizations' in _dict:
            args['customizations'] = [
                VoiceModel._from_dict(x) for x in (_dict.get('customizations'))
            ]
        else:
            raise ValueError(
                'Required property \'customizations\' not present in VoiceModels JSON'
            )
        return cls(**args)

Response: Initialize a VoiceModels object from a json dictionary.


Instruction:
How would you implement a function in Python 3 that
initializes a Voices object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a Voices object from a json dictionary."""
        args = {}
        if 'voices' in _dict:
            args['voices'] = [
                Voice._from_dict(x) for x in (_dict.get('voices'))
            ]
        else:
            raise ValueError(
                'Required property \'voices\' not present in Voices JSON')
        return cls(**args)


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'voices') and self.voices is not None:
            _dict['voices'] = [x._to_dict() for x in self.voices]
        return _dict


Instruction:
Can you create a Python 3 function that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'word') and self.word is not None:
            _dict['word'] = self.word
        if hasattr(self, 'translation') and self.translation is not None:
            _dict['translation'] = self.translation
        if hasattr(self, 'part_of_speech') and self.part_of_speech is not None:
            _dict['part_of_speech'] = self.part_of_speech
        return _dict


Instruction:
Write a Python 3 script to
invoke Tone Analyzer service to get the tone information for the user s input text and update the user s tone in the payload.

Response:
def invokeToneConversation(payload, maintainToneHistoryInContext):
    """
     invokeToneConversation calls the Tone Analyzer service to get the
     tone information for the user's input text (input['text'] in the payload
     json object), adds/updates the user's tone in the payload's context,
     and sends the payload to the
     conversation service to get a response which is printed to screen.
     :param payload: a json object containing the basic information needed to
     converse with the Conversation Service's message endpoint.
     :param maintainHistoryInContext:

     Note: as indicated below, the console.log statements can be replaced
     with application-specific code to process the err or data object
     returned by the Conversation Service.
    """
    tone = tone_analyzer.tone(tone_input=payload['input'], content_type='application/json').get_result()
    conversation_payload = tone_detection.\
        updateUserTone(payload, tone, maintainToneHistoryInContext)
    response = assistant.message(workspace_id=workspace_id,
                                 input=conversation_payload['input'],
                                 context=conversation_payload['context']).get_result()
    print(json.dumps(response, indent=2))


Instruction:
Create a Python 3 function to
convert a document to HTML.

Response:
def convert_to_html(self,
                        file,
                        filename=None,
                        file_content_type=None,
                        model=None,
                        **kwargs):
        """
        Convert document to HTML.

        Converts a document to HTML.

        :param file file: The document to convert.
        :param str filename: The filename for file.
        :param str file_content_type: The content type of file.
        :param str model: The analysis model to be used by the service. For the **Element
        classification** and **Compare two documents** methods, the default is
        `contracts`. For the **Extract tables** method, the default is `tables`. These
        defaults apply to the standalone methods as well as to the methods' use in
        batch-processing requests.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if file is None:
            raise ValueError('file must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1', 'convert_to_html')
        headers.update(sdk_headers)

        params = {'version': self.version, 'model': model}

        form_data = {}
        if not filename and hasattr(file, 'name'):
            filename = basename(file.name)
        if not filename:
            raise ValueError('filename must be provided')
        form_data['file'] = (filename, file, file_content_type or
                             'application/octet-stream')

        url = '/v1/html_conversion'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response


Instruction:
Can you tell what is the following Python 3 function doing
def classify_elements(self,
                          file,
                          file_content_type=None,
                          model=None,
                          **kwargs):
        """
        Classify the elements of a document.

        Analyzes the structural and semantic elements of a document.

        :param file file: The document to classify.
        :param str file_content_type: The content type of file.
        :param str model: The analysis model to be used by the service. For the **Element
        classification** and **Compare two documents** methods, the default is
        `contracts`. For the **Extract tables** method, the default is `tables`. These
        defaults apply to the standalone methods as well as to the methods' use in
        batch-processing requests.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if file is None:
            raise ValueError('file must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1',
                                      'classify_elements')
        headers.update(sdk_headers)

        params = {'version': self.version, 'model': model}

        form_data = {}
        form_data['file'] = (None, file, file_content_type or
                             'application/octet-stream')

        url = '/v1/element_classification'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response

Response: Classify the elements of a document.


Instruction:
Write a Python 3 function that can
compare two input documents.

Response:
def compare_documents(self,
                          file_1,
                          file_2,
                          file_1_content_type=None,
                          file_2_content_type=None,
                          file_1_label=None,
                          file_2_label=None,
                          model=None,
                          **kwargs):
        """
        Compare two documents.

        Compares two input documents. Documents must be in the same format.

        :param file file_1: The first document to compare.
        :param file file_2: The second document to compare.
        :param str file_1_content_type: The content type of file_1.
        :param str file_2_content_type: The content type of file_2.
        :param str file_1_label: A text label for the first document.
        :param str file_2_label: A text label for the second document.
        :param str model: The analysis model to be used by the service. For the **Element
        classification** and **Compare two documents** methods, the default is
        `contracts`. For the **Extract tables** method, the default is `tables`. These
        defaults apply to the standalone methods as well as to the methods' use in
        batch-processing requests.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if file_1 is None:
            raise ValueError('file_1 must be provided')
        if file_2 is None:
            raise ValueError('file_2 must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1',
                                      'compare_documents')
        headers.update(sdk_headers)

        params = {
            'version': self.version,
            'file_1_label': file_1_label,
            'file_2_label': file_2_label,
            'model': model
        }

        form_data = {}
        form_data['file_1'] = (None, file_1, file_1_content_type or
                               'application/octet-stream')
        form_data['file_2'] = (None, file_2, file_2_content_type or
                               'application/octet-stream')

        url = '/v1/comparison'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response


Instruction:
How would you code a function in Python 3 to
add feedback to a specific entry in the training model.

Response:
def add_feedback(self, feedback_data, user_id=None, comment=None, **kwargs):
        """
        Add feedback.

        Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a
        governing document.
        **Important:** Feedback is not immediately incorporated into the training model,
        nor is it guaranteed to be incorporated at a later date. Instead, submitted
        feedback is used to suggest future updates to the training model.

        :param FeedbackDataInput feedback_data: Feedback data for submission.
        :param str user_id: An optional string identifying the user.
        :param str comment: An optional comment on or description of the feedback.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if feedback_data is None:
            raise ValueError('feedback_data must be provided')
        feedback_data = self._convert_model(feedback_data, FeedbackDataInput)

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1', 'add_feedback')
        headers.update(sdk_headers)

        params = {'version': self.version}

        data = {
            'feedback_data': feedback_data,
            'user_id': user_id,
            'comment': comment
        }

        url = '/v1/feedback'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            json=data,
            accept_json=True)
        return response


Instruction:
Given the following Python 3 function, write the documentation
def get_feedback(self, feedback_id, model=None, **kwargs):

        if feedback_id is None:
            raise ValueError('feedback_id must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1', 'get_feedback')
        headers.update(sdk_headers)

        params = {'version': self.version, 'model': model}

        url = '/v1/feedback/{0}'.format(*self._encode_path_vars(feedback_id))
        response = self.request(
            method='GET',
            url=url,
            headers=headers,
            params=params,
            accept_json=True)
        return response

Response: Get a specific feedback entry.


Instruction:
Create a Python 3 function to
list the feedback in a document. Lists the feedback in a document. :param str feedback_type: An optional string that filters the output to include only feedback with the specified feedback type. The only permitted value is `element_classification`. :param date before: An optional string in the format `YYYY-MM-DD` that filters the output to include only feedback that was added before the specified date. :param date after: An optional string in the format `YYYY-MM-DD` that filters the output to include only feedback that was added after the specified date. :param str document_title: An optional string that filters the output to include only feedback from the document with the specified `document_title`. :param str model_id: An optional string that filters the output to include only feedback with the specified `model_id`. The only permitted value is `contracts`. :param str model_version: An optional string that filters the output to include only feedback with the specified `model_version`. :param str category_removed: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list removed. :param str category_added: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list added. :param str category_not_changed: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list unchanged. :param str type_removed: An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed. :param str type_added: An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed. :param str type_not_changed: An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list unchanged. :param int page_limit: An optional integer specifying the number of documents that you want the service to return. :param str cursor: An optional string that returns the set of documents after the previous set. Use this parameter with the `page_limit` parameter. :param str sort: An optional comma-separated list of fields in the document to sort on. You can optionally specify the sort direction by prefixing the value of the field with `-` for descending order or `+` for ascending order (the default). Currently permitted sorting fields are `created`, `user_id`, and `document_title`. :param bool include_total: An optional boolean value. If specified as `true`, the `pagination` object in the output includes a value called `total` that gives the total count of feedback created. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse

Response:
def list_feedback(self,
                      feedback_type=None,
                      before=None,
                      after=None,
                      document_title=None,
                      model_id=None,
                      model_version=None,
                      category_removed=None,
                      category_added=None,
                      category_not_changed=None,
                      type_removed=None,
                      type_added=None,
                      type_not_changed=None,
                      page_limit=None,
                      cursor=None,
                      sort=None,
                      include_total=None,
                      **kwargs):
        """
        List the feedback in a document.

        Lists the feedback in a document.

        :param str feedback_type: An optional string that filters the output to include
        only feedback with the specified feedback type. The only permitted value is
        `element_classification`.
        :param date before: An optional string in the format `YYYY-MM-DD` that filters the
        output to include only feedback that was added before the specified date.
        :param date after: An optional string in the format `YYYY-MM-DD` that filters the
        output to include only feedback that was added after the specified date.
        :param str document_title: An optional string that filters the output to include
        only feedback from the document with the specified `document_title`.
        :param str model_id: An optional string that filters the output to include only
        feedback with the specified `model_id`. The only permitted value is `contracts`.
        :param str model_version: An optional string that filters the output to include
        only feedback with the specified `model_version`.
        :param str category_removed: An optional string in the form of a comma-separated
        list of categories. If this is specified, the service filters the output to
        include only feedback that has at least one category from the list removed.
        :param str category_added: An optional string in the form of a comma-separated
        list of categories. If this is specified, the service filters the output to
        include only feedback that has at least one category from the list added.
        :param str category_not_changed: An optional string in the form of a
        comma-separated list of categories. If this is specified, the service filters the
        output to include only feedback that has at least one category from the list
        unchanged.
        :param str type_removed: An optional string of comma-separated `nature`:`party`
        pairs. If this is specified, the service filters the output to include only
        feedback that has at least one `nature`:`party` pair from the list removed.
        :param str type_added: An optional string of comma-separated `nature`:`party`
        pairs. If this is specified, the service filters the output to include only
        feedback that has at least one `nature`:`party` pair from the list removed.
        :param str type_not_changed: An optional string of comma-separated
        `nature`:`party` pairs. If this is specified, the service filters the output to
        include only feedback that has at least one `nature`:`party` pair from the list
        unchanged.
        :param int page_limit: An optional integer specifying the number of documents that
        you want the service to return.
        :param str cursor: An optional string that returns the set of documents after the
        previous set. Use this parameter with the `page_limit` parameter.
        :param str sort: An optional comma-separated list of fields in the document to
        sort on. You can optionally specify the sort direction by prefixing the value of
        the field with `-` for descending order or `+` for ascending order (the default).
        Currently permitted sorting fields are `created`, `user_id`, and `document_title`.
        :param bool include_total: An optional boolean value. If specified as `true`, the
        `pagination` object in the output includes a value called `total` that gives the
        total count of feedback created.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1', 'list_feedback')
        headers.update(sdk_headers)

        params = {
            'version': self.version,
            'feedback_type': feedback_type,
            'before': before,
            'after': after,
            'document_title': document_title,
            'model_id': model_id,
            'model_version': model_version,
            'category_removed': category_removed,
            'category_added': category_added,
            'category_not_changed': category_not_changed,
            'type_removed': type_removed,
            'type_added': type_added,
            'type_not_changed': type_not_changed,
            'page_limit': page_limit,
            'cursor': cursor,
            'sort': sort,
            'include_total': include_total
        }

        url = '/v1/feedback'
        response = self.request(
            method='GET',
            url=url,
            headers=headers,
            params=params,
            accept_json=True)
        return response


Instruction:
Write a Python 3 function for
submitting a batch - processing request for the given function and the given input document sets.

Response:
def create_batch(self,
                     function,
                     input_credentials_file,
                     input_bucket_location,
                     input_bucket_name,
                     output_credentials_file,
                     output_bucket_location,
                     output_bucket_name,
                     model=None,
                     **kwargs):
        """
        Submit a batch-processing request.

        Run Compare and Comply methods over a collection of input documents.
        **Important:** Batch processing requires the use of the [IBM Cloud Object Storage
        service](https://cloud.ibm.com/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-storage).
        The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using
        batch
        processing](https://cloud.ibm.com/docs/services/compare-comply/batching.html#before-you-batch).

        :param str function: The Compare and Comply method to run across the submitted
        input documents.
        :param file input_credentials_file: A JSON file containing the input Cloud Object
        Storage credentials. At a minimum, the credentials must enable `READ` permissions
        on the bucket defined by the `input_bucket_name` parameter.
        :param str input_bucket_location: The geographical location of the Cloud Object
        Storage input bucket as listed on the **Endpoint** tab of your Cloud Object
        Storage instance; for example, `us-geo`, `eu-geo`, or `ap-geo`.
        :param str input_bucket_name: The name of the Cloud Object Storage input bucket.
        :param file output_credentials_file: A JSON file that lists the Cloud Object
        Storage output credentials. At a minimum, the credentials must enable `READ` and
        `WRITE` permissions on the bucket defined by the `output_bucket_name` parameter.
        :param str output_bucket_location: The geographical location of the Cloud Object
        Storage output bucket as listed on the **Endpoint** tab of your Cloud Object
        Storage instance; for example, `us-geo`, `eu-geo`, or `ap-geo`.
        :param str output_bucket_name: The name of the Cloud Object Storage output bucket.
        :param str model: The analysis model to be used by the service. For the **Element
        classification** and **Compare two documents** methods, the default is
        `contracts`. For the **Extract tables** method, the default is `tables`. These
        defaults apply to the standalone methods as well as to the methods' use in
        batch-processing requests.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if function is None:
            raise ValueError('function must be provided')
        if input_credentials_file is None:
            raise ValueError('input_credentials_file must be provided')
        if input_bucket_location is None:
            raise ValueError('input_bucket_location must be provided')
        if input_bucket_name is None:
            raise ValueError('input_bucket_name must be provided')
        if output_credentials_file is None:
            raise ValueError('output_credentials_file must be provided')
        if output_bucket_location is None:
            raise ValueError('output_bucket_location must be provided')
        if output_bucket_name is None:
            raise ValueError('output_bucket_name must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('compare-comply', 'V1', 'create_batch')
        headers.update(sdk_headers)

        params = {'version': self.version, 'function': function, 'model': model}

        form_data = {}
        form_data['input_credentials_file'] = (None, input_credentials_file,
                                               'application/json')
        form_data['input_bucket_location'] = (None, input_bucket_location,
                                              'text/plain')
        form_data['input_bucket_name'] = (None, input_bucket_name, 'text/plain')
        form_data['output_credentials_file'] = (None, output_credentials_file,
                                                'application/json')
        form_data['output_bucket_location'] = (None, output_bucket_location,
                                               'text/plain')
        form_data['output_bucket_name'] = (None, output_bucket_name,
                                           'text/plain')

        url = '/v1/batches'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response


Instruction:
Implement a function in Python 3 to
initialize a AlignedElement object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a AlignedElement object from a json dictionary."""
        args = {}
        if 'element_pair' in _dict:
            args['element_pair'] = [
                ElementPair._from_dict(x) for x in (_dict.get('element_pair'))
            ]
        if 'identical_text' in _dict:
            args['identical_text'] = _dict.get('identical_text')
        if 'provenance_ids' in _dict:
            args['provenance_ids'] = _dict.get('provenance_ids')
        if 'significant_elements' in _dict:
            args['significant_elements'] = _dict.get('significant_elements')
        return cls(**args)


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'element_pair') and self.element_pair is not None:
            _dict['element_pair'] = [x._to_dict() for x in self.element_pair]
        if hasattr(self, 'identical_text') and self.identical_text is not None:
            _dict['identical_text'] = self.identical_text
        if hasattr(self, 'provenance_ids') and self.provenance_ids is not None:
            _dict['provenance_ids'] = self.provenance_ids
        if hasattr(self, 'significant_elements'
                  ) and self.significant_elements is not None:
            _dict['significant_elements'] = self.significant_elements
        return _dict


Instruction:
Write a Python 3 script to
return a json dictionary representing this object.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'function') and self.function is not None:
            _dict['function'] = self.function
        if hasattr(self, 'input_bucket_location'
                  ) and self.input_bucket_location is not None:
            _dict['input_bucket_location'] = self.input_bucket_location
        if hasattr(self,
                   'input_bucket_name') and self.input_bucket_name is not None:
            _dict['input_bucket_name'] = self.input_bucket_name
        if hasattr(self, 'output_bucket_location'
                  ) and self.output_bucket_location is not None:
            _dict['output_bucket_location'] = self.output_bucket_location
        if hasattr(
                self,
                'output_bucket_name') and self.output_bucket_name is not None:
            _dict['output_bucket_name'] = self.output_bucket_name
        if hasattr(self, 'batch_id') and self.batch_id is not None:
            _dict['batch_id'] = self.batch_id
        if hasattr(self,
                   'document_counts') and self.document_counts is not None:
            _dict['document_counts'] = self.document_counts._to_dict()
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = datetime_to_string(self.created)
        if hasattr(self, 'updated') and self.updated is not None:
            _dict['updated'] = datetime_to_string(self.updated)
        return _dict


Instruction:
Implement a function in Python 3 to
initialize a Batches object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a Batches object from a json dictionary."""
        args = {}
        if 'batches' in _dict:
            args['batches'] = [
                BatchStatus._from_dict(x) for x in (_dict.get('batches'))
            ]
        return cls(**args)


Instruction:
Create a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'batches') and self.batches is not None:
            _dict['batches'] = [x._to_dict() for x in self.batches]
        return _dict


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'cell_id' in _dict:
            args['cell_id'] = _dict.get('cell_id')
        if 'location' in _dict:
            args['location'] = Location._from_dict(_dict.get('location'))
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        if 'row_index_begin' in _dict:
            args['row_index_begin'] = _dict.get('row_index_begin')
        if 'row_index_end' in _dict:
            args['row_index_end'] = _dict.get('row_index_end')
        if 'column_index_begin' in _dict:
            args['column_index_begin'] = _dict.get('column_index_begin')
        if 'column_index_end' in _dict:
            args['column_index_end'] = _dict.get('column_index_end')
        if 'row_header_ids' in _dict:
            args['row_header_ids'] = [
                RowHeaderIds._from_dict(x)
                for x in (_dict.get('row_header_ids'))
            ]
        if 'row_header_texts' in _dict:
            args['row_header_texts'] = [
                RowHeaderTexts._from_dict(x)
                for x in (_dict.get('row_header_texts'))
            ]
        if 'row_header_texts_normalized' in _dict:
            args['row_header_texts_normalized'] = [
                RowHeaderTextsNormalized._from_dict(x)
                for x in (_dict.get('row_header_texts_normalized'))
            ]
        if 'column_header_ids' in _dict:
            args['column_header_ids'] = [
                ColumnHeaderIds._from_dict(x)
                for x in (_dict.get('column_header_ids'))
            ]
        if 'column_header_texts' in _dict:
            args['column_header_texts'] = [
                ColumnHeaderTexts._from_dict(x)
                for x in (_dict.get('column_header_texts'))
            ]
        if 'column_header_texts_normalized' in _dict:
            args['column_header_texts_normalized'] = [
                ColumnHeaderTextsNormalized._from_dict(x)
                for x in (_dict.get('column_header_texts_normalized'))
            ]
        if 'attributes' in _dict:
            args['attributes'] = [
                Attribute._from_dict(x) for x in (_dict.get('attributes'))
            ]
        return cls(**args)

Response: Initialize a BodyCells object from a json dictionary.


Instruction:
Make a summary of the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'cell_id') and self.cell_id is not None:
            _dict['cell_id'] = self.cell_id
        if hasattr(self, 'location') and self.location is not None:
            _dict['location'] = self.location._to_dict()
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self,
                   'row_index_begin') and self.row_index_begin is not None:
            _dict['row_index_begin'] = self.row_index_begin
        if hasattr(self, 'row_index_end') and self.row_index_end is not None:
            _dict['row_index_end'] = self.row_index_end
        if hasattr(
                self,
                'column_index_begin') and self.column_index_begin is not None:
            _dict['column_index_begin'] = self.column_index_begin
        if hasattr(self,
                   'column_index_end') and self.column_index_end is not None:
            _dict['column_index_end'] = self.column_index_end
        if hasattr(self, 'row_header_ids') and self.row_header_ids is not None:
            _dict['row_header_ids'] = [
                x._to_dict() for x in self.row_header_ids
            ]
        if hasattr(self,
                   'row_header_texts') and self.row_header_texts is not None:
            _dict['row_header_texts'] = [
                x._to_dict() for x in self.row_header_texts
            ]
        if hasattr(self, 'row_header_texts_normalized'
                  ) and self.row_header_texts_normalized is not None:
            _dict['row_header_texts_normalized'] = [
                x._to_dict() for x in self.row_header_texts_normalized
            ]
        if hasattr(self,
                   'column_header_ids') and self.column_header_ids is not None:
            _dict['column_header_ids'] = [
                x._to_dict() for x in self.column_header_ids
            ]
        if hasattr(
                self,
                'column_header_texts') and self.column_header_texts is not None:
            _dict['column_header_texts'] = [
                x._to_dict() for x in self.column_header_texts
            ]
        if hasattr(self, 'column_header_texts_normalized'
                  ) and self.column_header_texts_normalized is not None:
            _dict['column_header_texts_normalized'] = [
                x._to_dict() for x in self.column_header_texts_normalized
            ]
        if hasattr(self, 'attributes') and self.attributes is not None:
            _dict['attributes'] = [x._to_dict() for x in self.attributes]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you write a function in Python 3 where it
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'label') and self.label is not None:
            _dict['label'] = self.label
        if hasattr(self, 'provenance_ids') and self.provenance_ids is not None:
            _dict['provenance_ids'] = self.provenance_ids
        return _dict


Instruction:
Can you write a function in Python 3 where it
initializes a ClassifyReturn object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a ClassifyReturn object from a json dictionary."""
        args = {}
        if 'document' in _dict:
            args['document'] = Document._from_dict(_dict.get('document'))
        if 'model_id' in _dict:
            args['model_id'] = _dict.get('model_id')
        if 'model_version' in _dict:
            args['model_version'] = _dict.get('model_version')
        if 'elements' in _dict:
            args['elements'] = [
                Element._from_dict(x) for x in (_dict.get('elements'))
            ]
        if 'tables' in _dict:
            args['tables'] = [
                Tables._from_dict(x) for x in (_dict.get('tables'))
            ]
        if 'document_structure' in _dict:
            args['document_structure'] = DocStructure._from_dict(
                _dict.get('document_structure'))
        if 'parties' in _dict:
            args['parties'] = [
                Parties._from_dict(x) for x in (_dict.get('parties'))
            ]
        if 'effective_dates' in _dict:
            args['effective_dates'] = [
                EffectiveDates._from_dict(x)
                for x in (_dict.get('effective_dates'))
            ]
        if 'contract_amounts' in _dict:
            args['contract_amounts'] = [
                ContractAmts._from_dict(x)
                for x in (_dict.get('contract_amounts'))
            ]
        if 'termination_dates' in _dict:
            args['termination_dates'] = [
                TerminationDates._from_dict(x)
                for x in (_dict.get('termination_dates'))
            ]
        if 'contract_type' in _dict:
            args['contract_type'] = [
                ContractType._from_dict(x) for x in (_dict.get('contract_type'))
            ]
        return cls(**args)


Instruction:
How would you explain what the following Python 3 function does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'document') and self.document is not None:
            _dict['document'] = self.document._to_dict()
        if hasattr(self, 'model_id') and self.model_id is not None:
            _dict['model_id'] = self.model_id
        if hasattr(self, 'model_version') and self.model_version is not None:
            _dict['model_version'] = self.model_version
        if hasattr(self, 'elements') and self.elements is not None:
            _dict['elements'] = [x._to_dict() for x in self.elements]
        if hasattr(self, 'tables') and self.tables is not None:
            _dict['tables'] = [x._to_dict() for x in self.tables]
        if hasattr(
                self,
                'document_structure') and self.document_structure is not None:
            _dict['document_structure'] = self.document_structure._to_dict()
        if hasattr(self, 'parties') and self.parties is not None:
            _dict['parties'] = [x._to_dict() for x in self.parties]
        if hasattr(self,
                   'effective_dates') and self.effective_dates is not None:
            _dict['effective_dates'] = [
                x._to_dict() for x in self.effective_dates
            ]
        if hasattr(self,
                   'contract_amounts') and self.contract_amounts is not None:
            _dict['contract_amounts'] = [
                x._to_dict() for x in self.contract_amounts
            ]
        if hasattr(self,
                   'termination_dates') and self.termination_dates is not None:
            _dict['termination_dates'] = [
                x._to_dict() for x in self.termination_dates
            ]
        if hasattr(self, 'contract_type') and self.contract_type is not None:
            _dict['contract_type'] = [x._to_dict() for x in self.contract_type]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Write a Python 3 function that can
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'id') and self.id is not None:
            _dict['id'] = self.id
        return _dict


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self,
                   'text_normalized') and self.text_normalized is not None:
            _dict['text_normalized'] = self.text_normalized
        return _dict


Instruction:
Given the following Python 3 function, write the documentation
def _from_dict(cls, _dict):
        args = {}
        if 'model_id' in _dict:
            args['model_id'] = _dict.get('model_id')
        if 'model_version' in _dict:
            args['model_version'] = _dict.get('model_version')
        if 'documents' in _dict:
            args['documents'] = [
                Document._from_dict(x) for x in (_dict.get('documents'))
            ]
        if 'aligned_elements' in _dict:
            args['aligned_elements'] = [
                AlignedElement._from_dict(x)
                for x in (_dict.get('aligned_elements'))
            ]
        if 'unaligned_elements' in _dict:
            args['unaligned_elements'] = [
                UnalignedElement._from_dict(x)
                for x in (_dict.get('unaligned_elements'))
            ]
        return cls(**args)

Response: Initialize a CompareReturn object from a json dictionary.


Instruction:
How would you code a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'model_id') and self.model_id is not None:
            _dict['model_id'] = self.model_id
        if hasattr(self, 'model_version') and self.model_version is not None:
            _dict['model_version'] = self.model_version
        if hasattr(self, 'documents') and self.documents is not None:
            _dict['documents'] = [x._to_dict() for x in self.documents]
        if hasattr(self,
                   'aligned_elements') and self.aligned_elements is not None:
            _dict['aligned_elements'] = [
                x._to_dict() for x in self.aligned_elements
            ]
        if hasattr(
                self,
                'unaligned_elements') and self.unaligned_elements is not None:
            _dict['unaligned_elements'] = [
                x._to_dict() for x in self.unaligned_elements
            ]
        return _dict


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'role') and self.role is not None:
            _dict['role'] = self.role
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Create a Python 3 function to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'total') and self.total is not None:
            _dict['total'] = self.total
        if hasattr(self, 'pending') and self.pending is not None:
            _dict['pending'] = self.pending
        if hasattr(self, 'successful') and self.successful is not None:
            _dict['successful'] = self.successful
        if hasattr(self, 'failed') and self.failed is not None:
            _dict['failed'] = self.failed
        return _dict


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'section_titles' in _dict:
            args['section_titles'] = [
                SectionTitles._from_dict(x)
                for x in (_dict.get('section_titles'))
            ]
        if 'leading_sentences' in _dict:
            args['leading_sentences'] = [
                LeadingSentence._from_dict(x)
                for x in (_dict.get('leading_sentences'))
            ]
        return cls(**args)

Response: Initialize a DocStructure object from a json dictionary.


Instruction:
Create a Python 3 function to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'section_titles') and self.section_titles is not None:
            _dict['section_titles'] = [
                x._to_dict() for x in self.section_titles
            ]
        if hasattr(self,
                   'leading_sentences') and self.leading_sentences is not None:
            _dict['leading_sentences'] = [
                x._to_dict() for x in self.leading_sentences
            ]
        return _dict


Instruction:
Can you write a function in Python 3 where it
initializes a Element object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a Element object from a json dictionary."""
        args = {}
        if 'location' in _dict:
            args['location'] = Location._from_dict(_dict.get('location'))
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        if 'types' in _dict:
            args['types'] = [
                TypeLabel._from_dict(x) for x in (_dict.get('types'))
            ]
        if 'categories' in _dict:
            args['categories'] = [
                Category._from_dict(x) for x in (_dict.get('categories'))
            ]
        if 'attributes' in _dict:
            args['attributes'] = [
                Attribute._from_dict(x) for x in (_dict.get('attributes'))
            ]
        return cls(**args)


Instruction:
Can you generate the documentation for the following Python 3 function
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'begin') and self.begin is not None:
            _dict['begin'] = self.begin
        if hasattr(self, 'end') and self.end is not None:
            _dict['end'] = self.end
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a function in Python 3 to
initialize a FeedbackDataInput object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a FeedbackDataInput object from a json dictionary."""
        args = {}
        if 'feedback_type' in _dict:
            args['feedback_type'] = _dict.get('feedback_type')
        else:
            raise ValueError(
                'Required property \'feedback_type\' not present in FeedbackDataInput JSON'
            )
        if 'document' in _dict:
            args['document'] = ShortDoc._from_dict(_dict.get('document'))
        if 'model_id' in _dict:
            args['model_id'] = _dict.get('model_id')
        if 'model_version' in _dict:
            args['model_version'] = _dict.get('model_version')
        if 'location' in _dict:
            args['location'] = Location._from_dict(_dict.get('location'))
        else:
            raise ValueError(
                'Required property \'location\' not present in FeedbackDataInput JSON'
            )
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        else:
            raise ValueError(
                'Required property \'text\' not present in FeedbackDataInput JSON'
            )
        if 'original_labels' in _dict:
            args['original_labels'] = OriginalLabelsIn._from_dict(
                _dict.get('original_labels'))
        else:
            raise ValueError(
                'Required property \'original_labels\' not present in FeedbackDataInput JSON'
            )
        if 'updated_labels' in _dict:
            args['updated_labels'] = UpdatedLabelsIn._from_dict(
                _dict.get('updated_labels'))
        else:
            raise ValueError(
                'Required property \'updated_labels\' not present in FeedbackDataInput JSON'
            )
        return cls(**args)


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'feedback_type' in _dict:
            args['feedback_type'] = _dict.get('feedback_type')
        if 'document' in _dict:
            args['document'] = ShortDoc._from_dict(_dict.get('document'))
        if 'model_id' in _dict:
            args['model_id'] = _dict.get('model_id')
        if 'model_version' in _dict:
            args['model_version'] = _dict.get('model_version')
        if 'location' in _dict:
            args['location'] = Location._from_dict(_dict.get('location'))
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        if 'original_labels' in _dict:
            args['original_labels'] = OriginalLabelsOut._from_dict(
                _dict.get('original_labels'))
        if 'updated_labels' in _dict:
            args['updated_labels'] = UpdatedLabelsOut._from_dict(
                _dict.get('updated_labels'))
        if 'pagination' in _dict:
            args['pagination'] = Pagination._from_dict(_dict.get('pagination'))
        return cls(**args)

Response: Initialize a FeedbackDataOutput object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'feedback_type') and self.feedback_type is not None:
            _dict['feedback_type'] = self.feedback_type
        if hasattr(self, 'document') and self.document is not None:
            _dict['document'] = self.document._to_dict()
        if hasattr(self, 'model_id') and self.model_id is not None:
            _dict['model_id'] = self.model_id
        if hasattr(self, 'model_version') and self.model_version is not None:
            _dict['model_version'] = self.model_version
        if hasattr(self, 'location') and self.location is not None:
            _dict['location'] = self.location._to_dict()
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self,
                   'original_labels') and self.original_labels is not None:
            _dict['original_labels'] = self.original_labels._to_dict()
        if hasattr(self, 'updated_labels') and self.updated_labels is not None:
            _dict['updated_labels'] = self.updated_labels._to_dict()
        if hasattr(self, 'pagination') and self.pagination is not None:
            _dict['pagination'] = self.pagination._to_dict()
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'message') and self.message is not None:
            _dict['message'] = self.message
        return _dict


Instruction:
Create a Python 3 function to
initialize a FeedbackList object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a FeedbackList object from a json dictionary."""
        args = {}
        if 'feedback' in _dict:
            args['feedback'] = [
                GetFeedback._from_dict(x) for x in (_dict.get('feedback'))
            ]
        return cls(**args)


Instruction:
Given the following Python 3 function, write the documentation
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'feedback') and self.feedback is not None:
            _dict['feedback'] = [x._to_dict() for x in self.feedback]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Here you have a function in Python 3, explain what it does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'feedback_id') and self.feedback_id is not None:
            _dict['feedback_id'] = self.feedback_id
        if hasattr(self, 'user_id') and self.user_id is not None:
            _dict['user_id'] = self.user_id
        if hasattr(self, 'comment') and self.comment is not None:
            _dict['comment'] = self.comment
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = datetime_to_string(self.created)
        if hasattr(self, 'feedback_data') and self.feedback_data is not None:
            _dict['feedback_data'] = self.feedback_data._to_dict()
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you tell what is the following Python 3 function doing
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'num_pages') and self.num_pages is not None:
            _dict['num_pages'] = self.num_pages
        if hasattr(self, 'author') and self.author is not None:
            _dict['author'] = self.author
        if hasattr(self,
                   'publication_date') and self.publication_date is not None:
            _dict['publication_date'] = self.publication_date
        if hasattr(self, 'title') and self.title is not None:
            _dict['title'] = self.title
        if hasattr(self, 'html') and self.html is not None:
            _dict['html'] = self.html
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Write a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'cell_id') and self.cell_id is not None:
            _dict['cell_id'] = self.cell_id
        if hasattr(self, 'location') and self.location is not None:
            _dict['location'] = self.location._to_dict()
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        return _dict


Instruction:
Can you generate the documentation for the following Python 3 function
def _from_dict(cls, _dict):
        args = {}
        if 'key' in _dict:
            args['key'] = Key._from_dict(_dict.get('key'))
        if 'value' in _dict:
            args['value'] = Value._from_dict(_dict.get('value'))
        return cls(**args)

Response: Initialize a KeyValuePair object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'key') and self.key is not None:
            _dict['key'] = self.key._to_dict()
        if hasattr(self, 'value') and self.value is not None:
            _dict['value'] = self.value._to_dict()
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Write a Python 3 script to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'nature') and self.nature is not None:
            _dict['nature'] = self.nature
        if hasattr(self, 'party') and self.party is not None:
            _dict['party'] = self.party
        return _dict


Instruction:
How would you code a function in Python 3 to
initialize a LeadingSentence object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a LeadingSentence object from a json dictionary."""
        args = {}
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        if 'location' in _dict:
            args['location'] = Location._from_dict(_dict.get('location'))
        if 'element_locations' in _dict:
            args['element_locations'] = [
                ElementLocations._from_dict(x)
                for x in (_dict.get('element_locations'))
            ]
        return cls(**args)


Instruction:
Implement a Python 3 function for
initializing a OriginalLabelsIn object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a OriginalLabelsIn object from a json dictionary."""
        args = {}
        if 'types' in _dict:
            args['types'] = [
                TypeLabel._from_dict(x) for x in (_dict.get('types'))
            ]
        else:
            raise ValueError(
                'Required property \'types\' not present in OriginalLabelsIn JSON'
            )
        if 'categories' in _dict:
            args['categories'] = [
                Category._from_dict(x) for x in (_dict.get('categories'))
            ]
        else:
            raise ValueError(
                'Required property \'categories\' not present in OriginalLabelsIn JSON'
            )
        return cls(**args)


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'types') and self.types is not None:
            _dict['types'] = [x._to_dict() for x in self.types]
        if hasattr(self, 'categories') and self.categories is not None:
            _dict['categories'] = [x._to_dict() for x in self.categories]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Implement a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'refresh_cursor') and self.refresh_cursor is not None:
            _dict['refresh_cursor'] = self.refresh_cursor
        if hasattr(self, 'next_cursor') and self.next_cursor is not None:
            _dict['next_cursor'] = self.next_cursor
        if hasattr(self, 'refresh_url') and self.refresh_url is not None:
            _dict['refresh_url'] = self.refresh_url
        if hasattr(self, 'next_url') and self.next_url is not None:
            _dict['next_url'] = self.next_url
        if hasattr(self, 'total') and self.total is not None:
            _dict['total'] = self.total
        return _dict