def rename_kwargs(func_name, kwargs, aliases):
    for (alias, new) in aliases.items():
        if (alias in kwargs):
            if (new in kwargs):
                raise TypeError('{} received both {} and {}'.format(func_name, alias, new))
            warnings.warn('{} is deprecated; use {}'.format(alias, new), DeprecationWarning, 3)
            if (alias == 'device'):
                if kwargs[alias].__contains__('cuda'):
                    kwargs.pop(alias)
                    kwargs[new] = 1
                elif kwargs[alias].__contains__('cpu'):
                    kwargs.pop(alias)
                    kwargs[new] = 0
                else:
                    kwargs[new] = kwargs.pop(alias)
            elif (alias == 'multi_gpu'):
                kwargs.pop(alias)
            else:
                kwargs[new] = kwargs.pop(alias)
def rename_kwargs(func_name, kwargs, aliases):
    for (alias, new) in aliases.items():
        if (alias in kwargs):
            if (new in kwargs):
                raise TypeError('{} received both {} and {}'.format(func_name, alias, new))
            warnings.warn('{} is deprecated; use {}'.format(alias, new), DeprecationWarning, 3)
            if (alias == 'device'):
                if kwargs[alias].__contains__('cuda'):
                    kwargs.pop(alias)
                    kwargs[new] = 1
                elif kwargs[alias].__contains__('cpu'):
                    kwargs.pop(alias)
                    kwargs[new] = 0
                else:
                    kwargs[new] = kwargs.pop(alias)
            elif (alias == 'multi_gpu'):
                kwargs.pop(alias)
            else:
                kwargs[new] = kwargs.pop(alias)