def int_to_data5(val: int, *, bit_len: int = None) -> Sequence[int]:
    """Represent big-endian number with as many 0-31 values as it takes.
    If `bit_len` is set, use exactly bit_len//5 values (left-padded with zeroes).
    """
    if bit_len is not None:
        assert bit_len % 5 == 0, bit_len
        if val.bit_length() > bit_len:
            raise ValueError(f"{val=} too big for {bit_len=!r}")
    ret = []
    while val != 0:
        ret.append(val % 32)
        val //= 32
    if bit_len is not None:
        ret.extend([0] * (len(ret) - bit_len // 5))
    ret.reverse()
    return ret
Represent big-endian number with as many 0-31 values as it takes.
    If `bit_len` is set, use exactly bit_len//5 values (left-padded with zeroes).
    
electrum/lnaddr.py