code: def from_tuple(tup):
      
      if len(tup) not in (2, 3):
          raise ValueError(
              'tuple must contain 2 or 3 elements, not: %d (%r' % (
                  len(tup),
                  tup,
              ),
          )
      return range(*tup)
docs: Convert a tuple into a range with error handling.
  
      Parameters
      ----------
      tup : tuple (len 2 or 3)
          The tuple to turn into a range.
  
      Returns
      -------
      range : range
          The range from the tuple.
  
      Raises
      ------
      ValueError
          Raised when the tuple length is not 2 or 3.