def _raise_if_mismatch(expected, actual, prop_name, rank, is_property=False):
    tensor_property_or_metadata = ('tensor property' if is_property else 'local ShardMetadata')
    if (expected != actual):
        raise ValueError(f"Local shards' tensor {prop_name} property is incompatible with {tensor_property_or_metadata} on rank {rank}: {tensor_property_or_metadata} {prop_name}={expected}, local shard tensor {prop_name}={actual}.")
def _raise_if_mismatch(expected, actual, prop_name, rank, is_property=False):
    tensor_property_or_metadata = ('tensor property' if is_property else 'local ShardMetadata')
    if (expected != actual):
        raise ValueError(f"Local shards' tensor {prop_name} property is incompatible with {tensor_property_or_metadata} on rank {rank}: {tensor_property_or_metadata} {prop_name}={expected}, local shard tensor {prop_name}={actual}.")