@deprecate_kwarg(old_arg_name='<STR_LIT>', new_arg_name='<STR_LIT>')<EOL><INDENT>def set_codes(self, codes, level=None, inplace=False,<EOL>verify_integrity=True):<DEDENT>
if level is not None and not is_list_like(level):<EOL><INDENT>if not is_list_like(codes):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if is_list_like(codes[<NUM_LIT:0>]):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>level = [level]<EOL>codes = [codes]<EOL><DEDENT>elif level is None or is_list_like(level):<EOL><INDENT>if not is_list_like(codes) or not is_list_like(codes[<NUM_LIT:0>]):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT><DEDENT>if inplace:<EOL><INDENT>idx = self<EOL><DEDENT>else:<EOL><INDENT>idx = self._shallow_copy()<EOL><DEDENT>idx._reset_identity()<EOL>idx._set_codes(codes, level=level, verify_integrity=verify_integrity)<EOL>if not inplace:<EOL><INDENT>return idx<EOL><DEDENT>
Set new codes on MultiIndex. Defaults to returning
new index.

.. versionadded:: 0.24.0

   New name for deprecated method `set_labels`.

Parameters
----------
codes : sequence or list of sequence
    new codes to apply
level : int, level name, or sequence of int/level names (default None)
    level(s) to set (None for all levels)
inplace : bool
    if True, mutates in place
verify_integrity : bool (default True)
    if True, checks that levels and codes are compatible

Returns
-------
new index (of same type and class...etc)

Examples
--------
>>> idx = pd.MultiIndex.from_tuples([(1, 'one'), (1, 'two'),
                                    (2, 'one'), (2, 'two')],
                                    names=['foo', 'bar'])
>>> idx.set_codes([[1,0,1,0], [0,0,1,1]])
MultiIndex(levels=[[1, 2], ['one', 'two']],
           codes=[[1, 0, 1, 0], [0, 0, 1, 1]],
           names=['foo', 'bar'])
>>> idx.set_codes([1,0,1,0], level=0)
MultiIndex(levels=[[1, 2], ['one', 'two']],
           codes=[[1, 0, 1, 0], [0, 1, 0, 1]],
           names=['foo', 'bar'])
>>> idx.set_codes([0,0,1,1], level='bar')
MultiIndex(levels=[[1, 2], ['one', 'two']],
           codes=[[0, 0, 1, 1], [0, 0, 1, 1]],
           names=['foo', 'bar'])
>>> idx.set_codes([[1,0,1,0], [0,0,1,1]], level=[0,1])
MultiIndex(levels=[[1, 2], ['one', 'two']],
           codes=[[1, 0, 1, 0], [0, 0, 1, 1]],
           names=['foo', 'bar'])