'Returns a new cmdset with the same settings as this one (no
actual commands are copied over)
Returns:
cmdset (Cmdset): A copy of the current cmdset.'

def _duplicate(self):

    cmdset = CmdSet()
    for (key, val) in ((key, getattr(self, key)) for key in self.to_duplicate):
        if (val != getattr(cmdset, key)):
            setattr(cmdset, key, val)
    cmdset.key_mergetypes = self.key_mergetypes.copy()
    return cmdset
