class_docstr: MutableMapping that automatically spills out dask key/value pairs to disk when
  the total size of the stored data exceeds the target. If max_spill is provided the
  key/value pairs won't be spilled once this threshold has been reached.
  
  Parameters
  ----------
  spill_directory: str
      Location on disk to write the spill files to
  target: int
      Managed memory, in bytes, to start spilling at
  max_spill: int | False, optional
      Limit of number of bytes to be spilled on disk. Set to False to disable.
class_docstr_tok: ["MutableMapping","that","automatically","spills","out","dask","key\/value","pairs","to","disk","when","the","total","size","of","the","stored","data","exceeds","the","target",".","If","max_spill","is","provided","the","key\/value","pairs","wo","n't","be","spilled","once","this","threshold","has","been","reached",".","Parameters","--","--","--","--","--","spill_directory",":","str","Location","on","disk","to","write","the","spill","files","to","target",":","int","Managed","memory",",","in","bytes",",","to","start","spilling","at","max_spill",":","int","|","False",",","optional","Limit","of","number","of","bytes","to","be","spilled","on","disk",".","Set","to","False","to","disable","."]
code: def _handle_errors(self, key: Key | None) -> Iterator[None]:
      try:
          yield
      except MaxSpillExceeded as e:
          # key is in self.fast; no keys have been lost on eviction
          (key_e,) = e.args
          assert key_e in self.fast
          assert key_e not in self.slow
          logger.warning(
              "Spill file on disk reached capacity; keeping data in memory"
          )
          raise HandledError()
      except OSError:
          # Typically, this is a disk full error
          logger.error(
              "Spill to disk failed; keeping data in memory",
              exc_info=True,
          )
          raise HandledError()
      except PickleError as e:
          assert e.key in self.fast
          assert e.key not in self.slow
          if e.key == key:
              assert key is not None
              # The key we just inserted failed to serialize.
              # This happens only when the key is individually larger than target.
              # The exception will be caught by Worker and logged; the status of
              # the task will be set to error.
              del self[key]
              raise
          else:
              # The key we just inserted is smaller than target, but it caused
              # another, unrelated key to be spilled out of the LRU, and that key
              # failed to serialize. There's nothing wrong with the new key. The older
              # key is still in memory.
              if e.key not in self.logged_pickle_errors:
                  logger.error(
                      "Failed to pickle %r", e.key, exc_info=True
                  )
                  self.logged_pickle_errors.add(e.key)
              raise HandledError()
  
imports: from __future__ import annotations
  import logging
  from collections import defaultdict
  from collections.abc import Callable, Hashable, Iterator, Mapping, MutableMapping, Sized
  from contextlib import contextmanager
  from functools import partial
  from typing import Literal, NamedTuple, Protocol, cast
  import zict
  from dask.typing import Key
  from distributed.metrics import context_meter
  from distributed.protocol import deserialize_bytes, serialize_bytelist
  from distributed.protocol.compression import get_compression_settings
  from distributed.sizeof import safe_sizeof
  from distributed.utils import RateLimiterFilter, nbytes
label_desc: Use image node_id 3 for calling the SpillBuffer obj's underlying member method code with example usage: obj._handle_errors(key) without return types