Create a custom language model.

        Creates a new custom language model for a specified base model. The custom
        language model can be used only with the base model for which it is created. The
        model is owned by the instance of the service whose credentials are used to create
        it.
        **See also:** [Create a custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel-language).

        :param str name: A user-defined name for the new custom language model. Use a name
        that is unique among all custom language models that you own. Use a localized name
        that matches the language of the custom model. Use a name that describes the
        domain of the custom model, such as `Medical custom model` or `Legal custom
        model`.
        :param str base_model_name: The name of the base language model that is to be
        customized by the new custom language model. The new custom model can be used only
        with the base model that it customizes.
        To determine whether a base model supports language model customization, use the
        **Get a model** method and check that the attribute `custom_language_model` is set
        to `true`. You can also refer to [Language support for
        customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
        :param str dialect: The dialect of the specified language that is to be used with
        the custom language model. The parameter is meaningful only for Spanish models,
        for which the service creates a custom language model that is suited for speech in
        one of the following dialects:
        * `es-ES` for Castilian Spanish (the default)
        * `es-LA` for Latin American Spanish
        * `es-US` for North American (Mexican) Spanish
        A specified dialect must be valid for the base model. By default, the dialect
        matches the language of the base model; for example, `en-US` for either of the US
        English language models.
        :param str description: A description of the new custom language model. Use a
        localized description that matches the language of the custom model.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse

def create_language_model(self,
                              name,
                              base_model_name,
                              dialect=None,
                              description=None,
                              **kwargs):
        """
        Create a custom language model.

        Creates a new custom language model for a specified base model. The custom
        language model can be used only with the base model for which it is created. The
        model is owned by the instance of the service whose credentials are used to create
        it.
        **See also:** [Create a custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel-language).

        :param str name: A user-defined name for the new custom language model. Use a name
        that is unique among all custom language models that you own. Use a localized name
        that matches the language of the custom model. Use a name that describes the
        domain of the custom model, such as `Medical custom model` or `Legal custom
        model`.
        :param str base_model_name: The name of the base language model that is to be
        customized by the new custom language model. The new custom model can be used only
        with the base model that it customizes.
        To determine whether a base model supports language model customization, use the
        **Get a model** method and check that the attribute `custom_language_model` is set
        to `true`. You can also refer to [Language support for
        customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
        :param str dialect: The dialect of the specified language that is to be used with
        the custom language model. The parameter is meaningful only for Spanish models,
        for which the service creates a custom language model that is suited for speech in
        one of the following dialects:
        * `es-ES` for Castilian Spanish (the default)
        * `es-LA` for Latin American Spanish
        * `es-US` for North American (Mexican) Spanish
        A specified dialect must be valid for the base model. By default, the dialect
        matches the language of the base model; for example, `en-US` for either of the US
        English language models.
        :param str description: A description of the new custom language model. Use a
        localized description that matches the language of the custom model.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

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

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

        data = {
            'name': name,
            'base_model_name': base_model_name,
            'dialect': dialect,
            'description': description
        }

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