code: def _create_chunk_from_dtensor(
      tensor: DTensor,
  ) -> ChunkStorageMetadata:
      sizes, offsets = compute_local_shape_and_global_offset(
          tensor.shape, tensor.device_mesh, tensor.placements
      )
      sizes, offsets = torch.Size(sizes), torch.Size(offsets)
      return ChunkStorageMetadata(
          offsets=offsets,
          sizes=sizes,
      )
  
imports: from typing import Any, cast, List
  import torch
  import torch.distributed
  from torch._utils import _get_device_module
  from torch.distributed._shard.metadata import ShardMetadata
  from torch.distributed._shard.sharded_tensor import ShardedTensor
  from torch.distributed._shard.sharded_tensor.metadata import TensorProperties
  from torch.distributed._tensor import DTensor
  from torch.distributed._tensor._utils import compute_local_shape_and_global_offset
  from torch.utils._pytree import tree_map_only
  from .metadata import BytesStorageMetadata, ChunkStorageMetadata, MetadataIndex, STATE_DICT_TYPE, STORAGE_TYPES, TensorStorageMetadata
  from .planner import LoadItemType, ReadItem, SavePlan, TensorWriteData, WriteItem, WriteItemType
  from .resharding import _check_shard_metadata_pair_overlap, _shards_get_overlap_region_wrt_saved_tensor
label_desc: Use image node_id 13 for calling a global function with example usage: _create_chunk_from_dtensor(tensor) and returns: ChunkStorageMetadata