Sets whether or not the given flag is enabled or disabled.
        
        :param      flag | <XExporter.Flags>

def setFlag(self, flag, state=True):
        """
        Sets whether or not the given flag is enabled or disabled.
        
        :param      flag | <XExporter.Flags>
        """
        has_flag = self.testFlag(flag)
        if has_flag and not state:
            self.setFlags(self.flags() ^ flag)
        elif not has_flag and state:
            self.setFlags(self.flags() | flag)