code: def span(regions):
      """Returns a region that spans all of the bases in regions.
  
      This function returns a Range(chrom, start, stop), where start is the min
      of the starts in regions, and stop is the max end in regions. It may not be
      freshly allocated.
  
      Args:
        regions: list[Range]: a list of Range protos.
  
      Returns:
        A single Range proto.
  
      Raises:
        ValueError: if not all regions have the same reference_name.
        ValueError: if regions is empty.
      """
      if not regions:
          raise ValueError(
              "regions is empty but must have at least one region"
          )
      elif len(regions) == 1:
          return regions[0]
      elif any(
          r.reference_name != regions[0].reference_name for r in regions
      ):
          raise ValueError("regions must be all on the same contig")
      else:
          start = min(r.start for r in regions)
          end = max(r.end for r in regions)
          return make_range(regions[0].reference_name, start, end)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import re
  from typing import Dict, Iterable, Optional, Sequence
  from absl import logging
  from etils import epath
  import intervaltree
  import six
  from third_party.nucleus.io import bed
  from third_party.nucleus.protos import position_pb2
  from third_party.nucleus.protos import range_pb2
  from third_party.nucleus.protos import reference_pb2
  from third_party.nucleus.protos import variants_pb2
label_desc: Use image node_id 19 for calling a global function with example usage: span(regions) and returns: regions, make_range