def test_lookupByValue(self):
        """
        Constants can be looked up by their associated value, defined
        implicitly by the position in which the constant appears in the class
        definition or explicitly by the argument passed to L{FlagConstant}.
        """
        flag = self.FXF.lookupByValue(0x01)
        self.assertIs(flag, self.FXF.READ)

        flag = self.FXF.lookupByValue(0x02)
        self.assertIs(flag, self.FXF.WRITE)

        flag = self.FXF.lookupByValue(0x04)
        self.assertIs(flag, self.FXF.APPEND)

        flag = self.FXF.lookupByValue(0x20)
        self.assertIs(flag, self.FXF.EXCLUSIVE)

        flag = self.FXF.lookupByValue(0x40)
        self.assertIs(flag, self.FXF.TEXT)

        Constants can be looked up by their associated value, defined
        implicitly by the position in which the constant appears in the class
        definition or explicitly by the argument passed to L{FlagConstant}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/test/test_constants.py