def truncate(self, before=None, after=None):
if after and before and after < before:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>i, j = self.levels[<NUM_LIT:0>].slice_locs(before, after)<EOL>left, right = self.slice_locs(before, after)<EOL>new_levels = list(self.levels)<EOL>new_levels[<NUM_LIT:0>] = new_levels[<NUM_LIT:0>][i:j]<EOL>new_codes = [level_codes[left:right] for level_codes in self.codes]<EOL>new_codes[<NUM_LIT:0>] = new_codes[<NUM_LIT:0>] - i<EOL>return MultiIndex(levels=new_levels, codes=new_codes,<EOL>verify_integrity=False)<EOL>
Slice index between two labels / tuples, return new MultiIndex

Parameters
----------
before : label or tuple, can be partial. Default None
    None defaults to start
after : label or tuple, can be partial. Default None
    None defaults to end

Returns
-------
truncated : MultiIndex