Repository: home-assistant/core
File: homeassistant/helpers/service.py (Python)

Code before:
            (entity_domain, service_domain)
        )
        if entities is None:
            return {}
        return entities

    hass.services.async_register(
        service_domain,
        service_name,
        partial(
            entity_service_call,
            hass,
            get_entities,
            service_func,
            entity_device_classes=entity_device_classes,
            required_features=required_features,
        ),
        schema,
        supports_response,
        job_type=HassJobType.Coroutinefunction,
        description_placeholders=description_placeholders,
    )


@callback
def async_get_service_config_entry(
    hass: HomeAssistant, domain: str, entry_id: str
) -> ConfigEntry:
    """Get and validate a service config entry."""
    config_entry = hass.config_entries.async_get_entry(entry_id)
    if not config_entry:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,
            translation_key="service_config_entry_not_found",
            translation_placeholders={
                "domain": domain,
                "entry_id": entry_id,
            },
        )
    if config_entry.domain != domain:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,
            translation_key="service_config_entry_wrong_domain",
            translation_placeholders={
                "domain": domain,
                "entry_title": config_entry.title,
            },
        )
    if config_entry.state is not ConfigEntryState.LOADED:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,

Review comment (suggestion):
since this is already part of the service module, can we drop `_service` from the name? `service.async_get_config_entry`

Code after:
            (entity_domain, service_domain)
        )
        if entities is None:
            return {}
        return entities

    hass.services.async_register(
        service_domain,
        service_name,
        partial(
            entity_service_call,
            hass,
            get_entities,
            service_func,
            entity_device_classes=entity_device_classes,
            required_features=required_features,
        ),
        schema,
        supports_response,
        job_type=HassJobType.Coroutinefunction,
        description_placeholders=description_placeholders,
    )


@callback
def async_get_config_entry(
    hass: HomeAssistant, domain: str, entry_id: str
) -> ConfigEntry:
    """Get and validate a service config entry."""
    config_entry = hass.config_entries.async_get_entry(entry_id)
    if not config_entry:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,
            translation_key="service_config_entry_not_found",
            translation_placeholders={
                "domain": domain,
                "entry_id": entry_id,
            },
        )
    if config_entry.domain != domain:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,
            translation_key="service_config_entry_wrong_domain",
            translation_placeholders={
                "domain": domain,
                "entry_title": config_entry.title,
            },
        )
    if config_entry.state is not ConfigEntryState.LOADED:
        raise ServiceValidationError(
            translation_domain=HOMEASSISTANT_DOMAIN,