code: def from_tuple(tup):
      """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.
      """
      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)
  
file_path: zipline/zipline/utils/range.py
imports: import operator
  from six import PY2
  from toolz import peek
  from zipline.utils.functional import foldr
label_desc: Use image node_id 1 for calling a global function with example usage: from_tuple(tup) and returns: range