code: def worker_logs(
      self,
      context: AuthedServiceContext,
      worker_pool_id: UID,
      worker_id: UID,
      raw: bool = False,
  ) -> Union[bytes, str, SyftError]:
      worker_pool_worker = self._get_worker_pool_and_worker(
          context, worker_pool_id, worker_id
      )
      if isinstance(worker_pool_worker, SyftError):
          return worker_pool_worker
  
      _, linked_worker = worker_pool_worker
  
      result = linked_worker.resolve_with_context(context)
  
      if result.is_err():
          return SyftError(
              message=f"Failed to retrieve Linked SyftWorker {linked_worker.object_uid}"
          )
  
      worker = result.ok()
  
      if context.node.in_memory_workers:
          logs = b"Logs not implemented for In Memory Workers"
      else:
          with contextlib.closing(docker.from_env()) as client:
              docker_container = _get_worker_container(client, worker)
              if isinstance(docker_container, SyftError):
                  return docker_container
  
              try:
                  logs = cast(bytes, docker_container.logs())
              except docker.errors.APIError as e:
                  return SyftError(
                      f"Failed to get worker {worker.id} container logs. Error {e}"
                  )
  
      return logs if raw else logs.decode(errors="ignore")
  
imports: import contextlib
  from typing import Any
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import Union
  from typing import cast
  import docker
  from docker.models.containers import Container
  from ...serde.serializable import serializable
  from ...store.document_store import DocumentStore
  from ...store.linked_obj import LinkedObject
  from ...types.dicttuple import DictTuple
  from ...types.uid import UID
  from ..context import AuthedServiceContext
  from ..response import SyftError
  from ..response import SyftSuccess
  from ..service import AbstractService
  from ..service import SERVICE_TO_TYPES
  from ..service import TYPE_TO_SERVICE
  from ..service import service_method
  from ..user.user_roles import DATA_OWNER_ROLE_LEVEL
  from ..user.user_roles import DATA_SCIENTIST_ROLE_LEVEL
  from .utils import DEFAULT_WORKER_POOL_NAME
  from .utils import run_containers
  from .utils import run_workers_in_threads
  from .worker_image import SyftWorkerImage
  from .worker_image_stash import SyftWorkerImageStash
  from .worker_pool import ContainerSpawnStatus
  from .worker_pool import SyftWorker
  from .worker_pool import WorkerOrchestrationType
  from .worker_pool import WorkerPool
  from .worker_pool import WorkerStatus
  from .worker_pool import _get_worker_container
  from .worker_pool_stash import SyftWorkerPoolStash
  from .worker_service import WorkerService
  from .worker_stash import WorkerStash
label_desc: Use image node_id 8 for calling the SyftWorkerPoolService obj's underlying member method code with example usage: obj.worker_logs(context, worker_pool_id, worker_id, raw) and returns: unknown, worker_pool_worker, SyftError, docker_container, SyftError