def makeExcludesDict(self):
        """
        @return: A C{dict} that maps each option name appearing in
            self.mutuallyExclusive to a list of those option names that is it
            mutually exclusive with (can't appear on the cmd line with).
        """

        #create a mapping of long option name -> single character name
        longToShort = {}
        for optList in itertools.chain(self.optParams, self.optFlags):
            if optList[1] != None:
                longToShort[optList[0]] = optList[1]

        excludes = {}
        for lst in self.mutuallyExclusive:
            for i, longname in enumerate(lst):
                tmp = set(lst[:i] + lst[i+1:])
                for name in tmp.copy():
                    if name in longToShort:
                        tmp.add(longToShort[name])

                if longname in excludes:
                    excludes[longname] = excludes[longname].union(tmp)
                else:
                    excludes[longname] = tmp
        return excludes

        @return: A C{dict} that maps each option name appearing in
            self.mutuallyExclusive to a list of those option names that is it
            mutually exclusive with (can't appear on the cmd line with).
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_shellcomp.py