def _sc_encode(gain, peak):
    """Encode ReplayGain gain/peak values as a Sound Check string.
    """
    peak *= 32768.0
    g1 = int(min(round(10 ** (gain / -10) * 1000), 65534))
    g2 = int(min(round(10 ** (gain / -10) * 2500), 65534))
    uk = 0
    values = g1, g1, g2, g2, uk, uk, int(peak), int(peak), uk, uk
    return u' %08X' * 10 % values
