'Rename a multi.'

@require_oauth2_scope('subscribe')
@validate(VUser(), VModhash(), from_multi=VMultiByPath('from', require_edit=True, kinds='m'), to_path_info=VMultiPath('to', required=False, docs={'to': 'destination    multireddit    url    path'}), display_name=VLength('display_name', max_length=MAX_DISP_NAME, empty_error=None))
@api_doc(api_section.multis, uri='/api/multi/rename')
def POST_multi_rename(self, from_multi, to_path_info, display_name):

    if (not to_path_info):
        if display_name:
            path = LabeledMulti.slugify(from_multi.owner, display_name)
            to_path_info = VMultiPath('').run(path)
        else:
            raise RedditError('BAD_MULTI_PATH', code=400)
    to_multi = self._copy_multi(from_multi, to_path_info, rename=True)
    if display_name:
        to_multi.display_name = display_name
        to_multi._commit()
    from_multi.delete()
    return self._format_multi(to_multi)
