# Buggy code
def _try_mi(k):
    # TODO: what if a level contains tuples??
    loc = self.get_loc(k)
    new_values = series._values[loc]
    new_index = self[loc]
    new_index = maybe_droplevels(new_index, k)
    return Series(new_values, index=new_index, name=series.name)


# Traceback (TypeError)
Traceback (most recent call last):
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 420, in _get_values
fastpath=True).__finalize__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 222, in __init__
self.index = index
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/generic.py", line 2685, in __setattr__
return object.__setattr__(self, name, value)
File "pandas/src/properties.pyx", line 65, in pandas.lib.AxisProperty.__set__ (pandas/lib.c:44748)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/series.py", line 274, in _set_axis
labels = _ensure_index(labels)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/indexes/base.py", line 3409, in _ensure_index
return Index(index_like)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/indexes/base.py", line 268, in __new__
cls._scalar_data_error(data)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/indexes/base.py", line 483, in _scalar_data_error
repr(data)))
TypeError: Index(...) must be called with a collection of some kind, None was passed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/base.py", line 46, in __str__
return self.__unicode__()
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 306, in __unicode__
series_rep = Series.__unicode__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/series.py", line 984, in __unicode__
max_rows=max_rows)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/series.py", line 1025, in to_string
dtype=dtype, name=name, max_rows=max_rows)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/series.py", line 1052, in _get_repr
max_rows=max_rows)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/formats/format.py", line 145, in __init__
self._chk_truncate()
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/formats/format.py", line 158, in _chk_truncate
series = concat((series.iloc[:row_num],
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/indexing.py", line 1296, in __getitem__
return self._getitem_axis(key, axis=0)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/indexing.py", line 1587, in _getitem_axis
return self._get_slice_axis(key, axis=axis)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/indexing.py", line 1579, in _get_slice_axis
return self._slice(slice_obj, axis=axis, kind='iloc')
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/indexing.py", line 99, in _slice
return self.obj._slice(obj, axis=axis, kind=kind)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/core/series.py", line 578, in _slice
return self._get_values(slobj)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 422, in _get_values
return self[indexer]
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 396, in __getitem__
return self._get_val_at(self.index.get_loc(key))
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 392, in _get_val_at
return self.block.values._get_val_at(loc)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/array.py", line 308, in _get_val_at
if loc < 0:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

# Fixed code
def _try_mi(k):
    # TODO: what if a level contains tuples??
    loc = self.get_loc(k)
    new_values = series._values[loc]
    new_index = self[loc]
    new_index = maybe_droplevels(new_index, k)
    return series._constructor(
        new_values, index=new_index, name=series.name
    ).__finalize__(self)