code: def _wait_for_queue_empty(
      self, initial_queue_size: int, seconds: Optional[float]
  ) -> None:
      waiting_start: float = monotonic()
      time_elapsed: float = 0.0
      max_reconnect_wait_time: float = (
          self.STOP_QUEUE_MAX_TIME_NO_CONNECTION_SECONDS
          if seconds is None
          else seconds
      )
  
      if initial_queue_size > 0:
          if self._consumer.last_backoff_time > 0:
              logger.warning(
                  "We have been experiencing connection interruptions during your run."
                  " Neptune client will now try to resume connection and sync data for the next"
                  " %s seconds."
                  " You can also kill this process and synchronize your data manually later"
                  " using `neptune sync` command.",
                  max_reconnect_wait_time,
              )
          else:
              logger.warning(
                  "Waiting for the remaining %s operations to synchronize with Neptune."
                  " Do not kill this process.",
                  initial_queue_size,
              )
  
      while True:
          if seconds is None:
              if self._consumer.last_backoff_time == 0:
                  # reset `waiting_start` on successful action
                  waiting_start = monotonic()
              wait_time = self.STOP_QUEUE_STATUS_UPDATE_FREQ_SECONDS
          else:
              wait_time = max(
                  min(
                      seconds - time_elapsed,
                      self.STOP_QUEUE_STATUS_UPDATE_FREQ_SECONDS,
                  ),
                  0.0,
              )
          self._queue.wait_for_empty(wait_time)
          size_remaining = self._queue.size()
          already_synced = initial_queue_size - size_remaining
          already_synced_proc = (
              (already_synced / initial_queue_size) * 100
              if initial_queue_size
              else 100
          )
          if size_remaining == 0:
              if self._should_print_logs:
                  logger.info(
                      "All %s operations synced, thanks for waiting!",
                      initial_queue_size,
                  )
              return
  
          time_elapsed = monotonic() - waiting_start
          if (
              self._consumer.last_backoff_time > 0
              and time_elapsed >= max_reconnect_wait_time
          ):
              logger.warning(
                  "Failed to reconnect with Neptune in %s seconds."
                  " You have %s operations saved on disk that can be manually synced"
                  " using `neptune sync` command.",
                  max_reconnect_wait_time,
                  size_remaining,
              )
              return
  
          if seconds is not None and wait_time == 0:
              logger.warning(
                  "Failed to sync all operations in %s seconds."
                  " You have %s operations saved on disk that can be manually synced"
                  " using `neptune sync` command.",
                  seconds,
                  size_remaining,
              )
              return
  
          if not self._consumer.is_running():
              exception = (
                  NeptuneSynchronizationAlreadyStoppedException()
              )
              logger.warning(str(exception))
              return
  
          logger.warning(
              "Still waiting for the remaining %s operations"
              " (%.2f%% done). Please wait.",
              size_remaining,
              already_synced_proc,
          )
  
imports: import os
  import threading
  from datetime import datetime
  from pathlib import Path
  from queue import Queue
  from time import monotonic, time
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
  from neptune.common.exceptions import NeptuneException
  from neptune.common.warnings import NeptuneWarning, warn_once
  from neptune.constants import ASYNC_DIRECTORY
  from neptune.envs import NEPTUNE_SYNC_AFTER_STOP_TIMEOUT
  from neptune.exceptions import NeptuneSynchronizationAlreadyStoppedException
  from neptune.internal.disk_queue import DiskQueue
  from neptune.internal.init.parameters import DEFAULT_STOP_TIMEOUT
  from neptune.internal.metadata_file import MetadataFile
  from neptune.internal.operation import Operation
  from neptune.internal.operation_processors.operation_processor import OperationProcessor
  from neptune.internal.operation_processors.operation_storage import OperationStorage, get_container_dir
  from neptune.internal.operation_processors.utils import common_metadata
  from neptune.internal.signals_processing.utils import signal_batch_lag, signal_batch_processed, signal_batch_started
  from neptune.internal.threading.daemon import Daemon
  from neptune.internal.utils.disk_utilization import ensure_disk_not_overutilize
  from neptune.internal.utils.files import should_clean_internal_data
  from neptune.internal.utils.logger import logger
label_desc: Use image node_id 10 for calling the AsyncOperationProcessor obj's underlying member method code with example usage: obj._wait_for_queue_empty(initial_queue_size, seconds) without return types