'Merge two sets using intersection merger
Args:
cmdset_a (Cmdset): Cmdset given higher priority in the case of a tie.
cmdset_b (Cmdset): Cmdset given lower priority in the case of a tie.
Returns:
cmdset_c (Cmdset): The result of A (intersect) B operation.
Notes:
Intersection, C = A (intersect) B, means that C only gets the
parts of A and B that are the same (that is, the commands
of each set having the same name. Only the one of these
having the higher prio ends up in C).'

def _intersect(self, cmdset_a, cmdset_b):

    cmdset_c = cmdset_a._duplicate()
    if (cmdset_a.duplicates and (cmdset_a.priority == cmdset_b.priority)):
        for cmd in [cmd for cmd in cmdset_a if (cmd in cmdset_b)]:
            cmdset_c.add(cmd)
            cmdset_c.add(cmdset_b.get(cmd))
    else:
        cmdset_c.commands = [cmd for cmd in cmdset_a if (cmd in cmdset_b)]
    return cmdset_c
