def METHOD_NAME(
    self, service_ids: list[str], location_id: str = ""
) -> list[ServiceGroupDict]:
    assert service_ids, "Unexpectedly received an empty list of service IDs"
    params = ";".join(
        [f"servicePublicId={service_id}" for service_id in service_ids]
    )
    endpoint = (
        (f"v2/branches/{location_id}/services/groups;{params}")
        if location_id
        else (f"v1/services/groups;{params}")
    )
    response = self.get(endpoint)
    response.raise_for_status()
    # the shape depends on whether we hit v1 or v2
    response_data = response.json()
    # v2 API returns a list of service groups (expected to only have one item)
    if location_id:
        return response_data
    # v1 API returns a list of branches
    branches: list[BranchDict] = response_data
    service_groups = sum((branch["serviceGroups"] for branch in branches), [])
    return service_groups