def METHOD_NAME(
    self,
    location_name,  # type: str
    check_name_availability_parameters,  # type: _models.CheckNameAvailabilityParameters
    **kwargs  # type: Any
):
    # type: (...) -> _models.CheckNameAvailabilityResult
    """Check the availability of the resource name.
    :param location_name: Location.
    :type location_name: str
    :param check_name_availability_parameters: The name and type of the resource.
    :type check_name_availability_parameters:
     ~azure.mgmt.quantum.models.CheckNameAvailabilityParameters
    :keyword callable cls: A custom type or function that will be passed the direct response
    :return: CheckNameAvailabilityResult, or the result of cls(response)
    :rtype: ~azure.mgmt.quantum.models.CheckNameAvailabilityResult
    :raises: ~azure.core.exceptions.HttpResponseError
    """
    error_map = {
        401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
    }
    error_map.update(kwargs.pop('error_map', {}) or {})
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
    api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-10-preview"))  # type: str
    content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json"))  # type: Optional[str]
    cls = kwargs.pop('cls', None)  # type: ClsType[_models.CheckNameAvailabilityResult]
    _json = self._serialize.body(check_name_availability_parameters, 'CheckNameAvailabilityParameters')
    request = build_check_name_availability_request(
        subscription_id=self._config.subscription_id,
        location_name=location_name,
        api_version=api_version,
        content_type=content_type,
        json=_json,
        template_url=self.METHOD_NAME.metadata['url'],
        headers=_headers,
        params=_params,
    )
    request = _convert_request(request)
    request.url = self._client.format_url(request.url)  # type: ignore
    pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
        request,
        stream=False,
        **kwargs
    )
    response = pipeline_response.http_response
    if response.status_code not in [200]:
        map_error(status_code=response.status_code, response=response, error_map=error_map)
        error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
        raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
    deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized