code: def sample_to_condition(
      mutables: dict[str, LabeledMutable], sample: Sample
  ) -> MutableExpression[bool] | bool:
      """Convert a sample to a condition that can be used to verify whether a new sample is compatible with the old one.
      Freeze the returned condition with a certain sample to get a boolean value.
  
      Parameters
      ----------
      mutables
          A dictionary mapping label to mutable. Get it from :meth:`Mutable.simplify`.
      sample
          A sample to convert.
      """
      conditions = [
          (mutables[label] == value) for label, value in sample.items()
      ]
      # Must use `&` here, `and` is not supported in MutableExpression
      return functools.reduce(lambda x, y: x & y, conditions, True)
  
imports: from __future__ import annotations
  import functools
  import logging
  import tempfile
  from typing import Any, Iterable
  import torch
  from torch import nn
  from nn_meter import load_latency_predictor, nnMeterPredictor
  from nni.mutable import Mutable, MutableList, LabeledMutable, Sample, MutableExpression
  from nni.nas.nn.pytorch import ModelSpace, MutableModule, LayerChoice, Repeat
  from nni.nas.profiler import ExpressionProfiler
  from .utils import MutableShape, ShapeTensor, standardize_arguments, submodule_input_output_shapes, is_leaf_module, concat_name
label_desc: Use image node_id 2 for calling a global function with example usage: sample_to_condition(mutables, sample) and returns: functools