def rva_to_soundcheck(rva):
    # http://projects.robinbowes.com/flac2mp3/trac/ticket/30#comment:7
    # [-1]: prefixed with a space
    # [0, 1]: volume adjustment in 1/1000 W per dBm
    # [2, 3]: volume adjustment in 1/2500 W per dBm
    # [4, 5]: unsure (identical for same song when volumes differ)
    # [6, 7]: peak (max sample) as absolute value: 0x7FFF for 16-bit samples
    # [8, 9]: same as [4, 5]
    gain2sc = lambda gain, base: min(round((10 ** (-gain/10)) * base), 65534) % u"%08X"

    sc = [
        u"",
        # 1/1000 W per dBm
        gain2sc(rva.gain, 1000),
        gain2sc(rva.gain, 1000),
        # 1/2500 W per dBm
        gain2sc(rva.gain, 2500),
        gain2sc(rva.gain, 2500),
        u"00024CA8",
        u"00024CA8",
        u"00007FFF",
        u"00007FFF",
        u"00024CA8",
        u"00024CA8",
    ]

    return u" ".join(sc)
dataset/ETHPy150Open grawity/hacks/lib/python/nullroute/mp3tags.py/rva_to_soundcheck/swapped operands of `%`