code: def toSet(self, flags):
          
          return {key for key, value in self.items() if value & flags}
docs: Generates a flag value based on the given set of values.
  
          :param values: <set>
  
          :return: <int>