<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_index_from_sequences(sequences, names=None):
 """ Construct an index from sequences of data. A single sequence returns an Index. Many sequences returns a MultiIndex. Parameters sequences : sequence of sequences names : sequence of str Returns ------- index : Index or MultiIndex Examples -------- Int64Index([1, 2, 3], dtype='int64', name='name') names=['L1', 'L2']) MultiIndex(levels=[['a'], ['a', 'b']], codes=[[0, 0], [0, 1]], names=['L1', 'L2']) See Also -------- ensure_index """

    from .multi import MultiIndex

    if len(sequences) == 1:
        if names is not None:
            names = names[0]
        return Index(sequences[0], name=names)
    else:
        return MultiIndex.from_arrays(sequences, names=names)