'Remove duplicate command-keys (unsafe)
Args:
caller (object): Commands on this object will
get preference in the duplicate removal.
Notes:
This is an unsafe command meant to clean out a cmdset of
doublet commands after it has been created. It is useful
for commands inheriting cmdsets from the cmdhandler where
obj-based cmdsets always are added double. Doublets will
be weeded out with preference to commands defined on
caller, otherwise just by first-come-first-served.'

def make_unique(self, caller):

    unique = {}
    for cmd in self.commands:
        if (cmd.key in unique):
            ocmd = unique[cmd.key]
            if ((hasattr(cmd, 'obj') and (cmd.obj == caller)) and (not (hasattr(ocmd, 'obj') and (ocmd.obj == caller)))):
                unique[cmd.key] = cmd
        else:
            unique[cmd.key] = cmd
    self.commands = listvalues(unique)
