code: def to_samples(
      inputs: List[Any], targets: Optional[List[Any]] = None
  ) -> List[Dict[str, Any]]:
      """Package a list of inputs and, optionally, a list of targets in a list of dictionaries (samples).
  
      Args:
          inputs: The list of inputs to package as dictionaries.
          targets: Optionally provide a list of targets to also be included in the samples.
  
      Returns:
          A list of sample dictionaries.
  
      """
      if targets is None:
          return [to_sample(input) for input in inputs]
      return [to_sample(input) for input in zip(inputs, targets)]
  
imports: from typing import Any, Dict, List, Optional, TypeVar
  from flash.core.data.io.input import DataKeys
  from flash.core.data.utilities.classification import _is_list_like
label_desc: Use image node_id 2 for calling a global function with example usage: to_samples(inputs, targets) and returns: unknown, unknown