'Remove the duplicate entries in cmdline making sure that the first
duplicate occurrences are the ones removed and the last one remains
(this is in order to not change the semantics of the "console"
parameter where the last occurrence has special meaning)
:param cmdline: a space separate list of kernel boot parameters
(ex. \'console=ttyS0,57600n8 nmi_watchdog=1\')
:return: a space separated list of kernel boot parameters without
duplicates'

def _remove_duplicate_cmdline_args(self, cmdline):

    copied = set()
    new_args = []
    for arg in reversed(cmdline.split()):
        if (arg not in copied):
            new_args.insert(0, arg)
            copied.add(arg)
    return '    '.join(new_args)
