@staticmethod
    def pwm32_to_hex_string(source_int):

        # generated by the int_to_pwm.py script in the mpf/tools folder

        lookup_table = {
                        0: '00000000',   # 00000000000000000000000000000000
                        1: '00000002',   # 00000000000000000000000000000010
                        2: '00020002',   # 00000000000000100000000000000010
                        3: '00400802',   # 00000000010000000000100000000010
                        4: '02020202',   # 00000010000000100000001000000010
                        5: '04102082',   # 00000100000100000010000010000010
                        6: '08420842',   # 00001000010000100000100001000010
                        7: '10884422',   # 00010000100010000100010000100010
                        8: '22222222',   # 00100010001000100010001000100010
                        9: '22448912',   # 00100010010001001000100100010010
                        10: '24922492',  # 00100100100100100010010010010010
                        11: '4924924a',  # 01001001001001001001001001001010
                        12: '4a4a4a4a',  # 01001010010010100100101001001010
                        13: '5294a52a',  # 01010010100101001010010100101010
                        14: '54aa54aa',  # 01010100101010100101010010101010
                        15: '5554aaaa',  # 01010101010101001010101010101010
                        16: 'aaaaaaaa',  # 10101010101010101010101010101010
                        17: 'aaab5556',  # 10101010101010110101010101010110
                        18: 'ab56ab56',  # 10101011010101101010101101010110
                        19: 'ad6b5ad6',  # 10101101011010110101101011010110
                        20: 'b6b6b6b6',  # 10110110101101101011011010110110
                        21: 'b6db6db6',  # 10110110110110110110110110110110
                        22: 'db6edb6e',  # 11011011011011101101101101101110
                        23: 'ddbb76ee',  # 11011101101110110111011011101110
                        24: 'eeeeeeee',  # 11101110111011101110111011101110
                        25: 'ef77bbde',  # 11101111011101111011101111011110
                        26: 'f7bef7be',  # 11110111101111101111011110111110
                        27: 'fbefdf7e',  # 11111011111011111101111101111110
                        28: 'fefefefe',  # 11111110111111101111111011111110
                        29: 'ffbff7fe',  # 11111111101111111111011111111110
                        30: 'fffefffe',  # 11111111111111101111111111111110
                        31: 'fffffffe',  # 11111111111111111111111111111110
                        32: 'ffffffff',  # 11111111111111111111111111111111
                        }

        if 0 <= source_int <= 32:
            return lookup_table[source_int]
        else:
            raise ValueError("%s is invalid pwm hex value. (Expected value "
                             "0-32)" % (source_int))
dataset/ETHPy150Open missionpinball/mpf/mpf/system/utility_functions.py/Util.pwm32_to_hex_string/original