code: def get_attached_bytes_map(meta_graph):
    
    result = {}
    if ATTACHMENT_COLLECTION_SAVED not in meta_graph.collection_def:
      return result
    collection_def = meta_graph.collection_def[ATTACHMENT_COLLECTION_SAVED]
    if collection_def.WhichOneof("kind") != "bytes_list":
      raise ValueError(
          "Internal CollectionDef for attached messages has kind %s, "
          "expected bytes_list" % collection_def.WhichOneof("kind"))
    attachment = module_attachment_pb2.ModuleAttachment()
    for value in collection_def.bytes_list.value:
      attachment.ParseFromString(value)
      result[attachment.key] = attachment.value  # Immutable; needs no copy.
    return result
docs: Returns the dict of ModuleAttachments stored in `meta_graph`.
  
    Args:
      meta_graph: A MetaGraphDef, as built by SavedModelHandler.add_graph_copy()
        from some graph.
  
    Returns:
      A dict, containing the `(key, bytes)` items passed to `attach_bytes()`
      when the graph had been built.
  
    Raises:
      ValueError: if `meta-graph` is malformed.