class_docstr: A dict-like proxy held by the Doc, to control access to span groups.
class_docstr_tok: ["A","dict-like","proxy","held","by","the","Doc",",","to","control","access","to","span","groups","."]
code: def to_bytes(self) -> bytes:
      # We serialize this as a dict in order to track the key(s) a SpanGroup
      # is a value of (in a backward- and forward-compatible way), since
      # a SpanGroup can have a key that doesn't match its `.name` (See #10685)
      if len(self) == 0:
          return self._EMPTY_BYTES
      msg: Dict[bytes, List[str]] = {}
      for key, value in self.items():
          msg.setdefault(value.to_bytes(), []).append(key)
      return srsly.msgpack_dumps(msg)
  
file_path: spacy/spacy/tokens/_dict_proxies.py
imports: import warnings
  import weakref
  from collections import UserDict
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Tuple, Union
  import srsly
  from ..errors import Errors, Warnings
  from .span_group import SpanGroup
label_desc: Use image node_id 6 for calling the SpanGroups obj's underlying member method code with example usage: obj.to_bytes() and returns: srsly, self