code: def _in_memory_weight(key: Key, value: object) -> int:
      return safe_sizeof(value)
  
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 1 for calling a global function with example usage: _in_memory_weight(key, value) and returns: safe_sizeof