nodes: 0, module; 1, function_definition; 2, function_name:from_tuples; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:tuples; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, identifier:sortorder; 14, None; 15, identifier:names; 16, None; 17, comment:"""
          Convert list of tuples to MultiIndex.
  
          Parameters
          ----------
          tuples : list / sequence of tuple-likes
              Each tuple is the index of one row/column.
          sortorder : int or None
              Level of sortedness (must be lexicographically sorted by that
              level).
          names : list / sequence of str, optional
              Names for the levels in the index.
  
          Returns
          -------
          index : MultiIndex
  
          See Also
          --------
          MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
          MultiIndex.from_product : Make a MultiIndex from cartesian product
                                    of iterables.
          MultiIndex.from_frame : Make a MultiIndex from a DataFrame.
  
          Examples
          --------
          >>> tuples = [(1, 'red'), (1, 'blue'),
          ...           (2, 'red'), (2, 'blue')]
          >>> pd.MultiIndex.from_tuples(tuples, names=('number', 'color'))
          MultiIndex(levels=[[1, 2], ['blue', 'red']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['number', 'color'])
          """; 18, not_operator; 19, block; 20, elif_clause; 21, comparison_operator:len(tuples) == 0; 22, block; 23, elif_clause; 24, elif_clause; 25, else_clause; 26, call; 27, call; 28, raise_statement; 29, call; 30, block; 31, call; 32, integer:0; 33, if_statement; 34, expression_statement; 35, call; 36, block; 37, call; 38, block; 39, block; 40, attribute; 41, argument_list; 42, identifier:is_list_like; 43, argument_list; 44, call; 45, identifier:is_iterator; 46, argument_list; 47, expression_statement; 48, identifier:len; 49, argument_list; 50, comparison_operator:names is None; 51, block; 52, assignment; 53, identifier:isinstance; 54, argument_list; 55, if_statement; 56, expression_statement; 57, identifier:isinstance; 58, argument_list; 59, expression_statement; 60, expression_statement; 61, identifier:MultiIndex; 62, identifier:from_arrays; 63, identifier:arrays; 64, keyword_argument; 65, keyword_argument; 66, identifier:tuples; 67, identifier:TypeError; 68, argument_list; 69, identifier:tuples; 70, assignment; 71, identifier:tuples; 72, identifier:names; 73, None; 74, expression_statement; 75, raise_statement; 76, identifier:arrays; 77, binary_operator:[[]] * len(names); 78, identifier:tuples; 79, tuple; 80, call; 81, block; 82, assignment; 83, identifier:tuples; 84, identifier:list; 85, assignment; 86, assignment; 87, identifier:sortorder; 88, identifier:sortorder; 89, identifier:names; 90, identifier:names; 91, string; 92, identifier:tuples; 93, call; 94, assignment; 95, call; 96, list; 97, call; 98, attribute; 99, identifier:Index; 100, identifier:isinstance; 101, argument_list; 102, expression_statement; 103, identifier:arrays; 104, call; 105, identifier:arrays; 106, call; 107, identifier:arrays; 108, call; 109, string_content:Input must be a list / sequence of tuple-likes.; 110, identifier:list; 111, argument_list; 112, identifier:msg; 113, string; 114, identifier:TypeError; 115, argument_list; 116, list; 117, identifier:len; 118, argument_list; 119, identifier:np; 120, identifier:ndarray; 121, identifier:tuples; 122, identifier:Index; 123, assignment; 124, identifier:list; 125, argument_list; 126, identifier:list; 127, argument_list; 128, identifier:lzip; 129, argument_list; 130, identifier:tuples; 131, string_content:Cannot infer number of levels from empty list; 132, identifier:msg; 133, identifier:names; 134, identifier:tuples; 135, attribute; 136, attribute; 137, attribute; 138, list_splat; 139, identifier:tuples; 140, identifier:_values; 141, call; 142, identifier:T; 143, call; 144, identifier:T; 145, identifier:tuples; 146, attribute; 147, argument_list; 148, attribute; 149, argument_list; 150, identifier:lib; 151, identifier:tuples_to_object_array; 152, identifier:tuples; 153, identifier:lib; 154, identifier:to_object_array_tuples; 155, identifier:tuples
code: def from_tuples(cls, tuples, sortorder=None, names=None):
          """
          Convert list of tuples to MultiIndex.
  
          Parameters
          ----------
          tuples : list / sequence of tuple-likes
              Each tuple is the index of one row/column.
          sortorder : int or None
              Level of sortedness (must be lexicographically sorted by that
              level).
          names : list / sequence of str, optional
              Names for the levels in the index.
  
          Returns
          -------
          index : MultiIndex
  
          See Also
          --------
          MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
          MultiIndex.from_product : Make a MultiIndex from cartesian product
                                    of iterables.
          MultiIndex.from_frame : Make a MultiIndex from a DataFrame.
  
          Examples
          --------
          >>> tuples = [(1, 'red'), (1, 'blue'),
          ...           (2, 'red'), (2, 'blue')]
          >>> pd.MultiIndex.from_tuples(tuples, names=('number', 'color'))
          MultiIndex(levels=[[1, 2], ['blue', 'red']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['number', 'color'])
          """
          if not is_list_like(tuples):
              raise TypeError('Input must be a list / sequence of tuple-likes.')
          elif is_iterator(tuples):
              tuples = list(tuples)
  
          if len(tuples) == 0:
              if names is None:
                  msg = 'Cannot infer number of levels from empty list'
                  raise TypeError(msg)
              arrays = [[]] * len(names)
          elif isinstance(tuples, (np.ndarray, Index)):
              if isinstance(tuples, Index):
                  tuples = tuples._values
  
              arrays = list(lib.tuples_to_object_array(tuples).T)
          elif isinstance(tuples, list):
              arrays = list(lib.to_object_array_tuples(tuples).T)
          else:
              arrays = lzip(*tuples)
  
          return MultiIndex.from_arrays(arrays, sortorder=sortorder, names=names)