    def service_from_orm(
        self,
        orm_service: orm.Service,
    ) -> Service:
        """Create the service instance and related objects from
        ORM data.

        Args:
            orm_service (orm.Service): The `orm.Service` object

        Returns:
            Service: the created service
        """

        name = orm_service.name
        if self.subdomain_host:
            parsed_host = urlparse(self.subdomain_host)
            domain = self.subdomain_hook(name, parsed_host.hostname, kind="service")
            host = f"{parsed_host.scheme}://{domain}"
            if parsed_host.port:
                host = f"{host}:{parsed_host.port}"
        else:
            domain = host = ''

        service = Service(
            parent=self,
            app=self,
            base_url=self.base_url,
            db=self.db,
            orm=orm_service,
            roles=orm_service.roles,
            domain=domain,
            host=host,
            hub=self.hub,
        )
        traits = service.traits(input=True)
        for key, trait in traits.items():
            if not trait.metadata.get("in_db", True):
                continue
            orm_value = getattr(orm_service, key)
            if orm_value is not None:
                setattr(service, key, orm_value)

        if orm_service.oauth_client is not None:
            service.oauth_client_id = orm_service.oauth_client.identifier
            service.oauth_redirect_uri = orm_service.oauth_client.redirect_uri
            oauth_msg = f"with ouath_client_id={orm_service.oauth_client.identifier}"
        else:
            oauth_msg = "without oauth"

        self.log.info(f"Loaded service {service.name} from database {oauth_msg}.")

        self._service_map[name] = service

        return service
Create the service instance and related objects from
ORM data.

Args:
orm_service (orm.Service): The `orm.Service` object

Returns:
Service: the created service
jupyterhub/app.py