def __call__(self, val):
        """Return a list with a string for each True bit in the integer."""
        if not val:
            return None

        bits = []
        for n in self._names:
            if val & 0x1:
                bits.append(n)
            val >>= 1
            if not val:
                break

        # Return whole list if empty or multiple items, otherwise just single item
        return bits[0] if len(bits) == 1 else bits
def __call__ ( self , val ) : if not val : return None bits = [ ] for n in self . _names : if val & 0x1 : bits . append ( n ) val >>= 1 if not val : break return bits [ 0 ] if len ( bits ) == 1 else bits
Return a list with a string for each True bit in the integer.