code: def all_spans(artifacts):
      """Returns the sorted artifacts with unique spans.
  
      By default, all artifacts with unique spans (ties broken by latest version)
      are returned.
  
      Example usage:
  
        Consider 6 artifacts with:
          spans    = [1, 3, 3, 2, 8, 7]
          versions = [0, 0, 1, 0, 1, 2]
  
        all_spans()
  
        will return artifacts:
          spans    = [1, 2, 3, 7, 8]
          versions = [0, 0, 1, 2, 1]
  
        Note that there are 2 artifacts with span 3, but only the one with the
        latest version is returned. Spans are sorted in ascending order.
  
      Args:
        artifacts: The artifacts to filter.
  
      Returns:
        Sorted Artifacts with unique spans.
      """
      return ops.AllSpans(artifacts)
  
imports: from typing import Optional, Sequence, Union
  from absl import logging
  from tfx.dsl.input_resolution import resolver_function
  from tfx.dsl.input_resolution.ops import ops
  from tfx.types import artifact
  from tfx.types import channel
label_desc: Use image node_id 5 for calling a global function with example usage: all_spans(artifacts) and returns: ops