    def _check_service_model(self, model):
        """Check a request-provided service model from a REST API"""
        self._check_model(model, self._service_model_types, 'service')
        service_name = model.get('name')
        if not isinstance(service_name, str):
            raise web.HTTPError(
                400, ("Service name must be str, not %r", type(service_name))
            )
Check a request-provided service model from a REST API
jupyterhub/apihandlers/base.py