def trim_to_min_length(bits):
    "Ensures 'bits' have min number of leading zeroes.\n    Assumes 'bits' is big-endian, and that it needs to be encoded in 5 bit blocks.\n    "
    bits = bits[:]
    while ((bits.len % 5) != 0):
        bits.prepend('0b0')
    while bits.startswith('0b00000'):
        if (len(bits) == 5):
            break
        bits = bits[5:]
    return bits
Ensures 'bits' have min number of leading zeroes.
Assumes 'bits' is big-endian, and that it needs to be encoded in 5 bit blocks.
def trim_to_min_length(bits):
    "Ensures 'bits' have min number of leading zeroes.\n    Assumes 'bits' is big-endian, and that it needs to be encoded in 5 bit blocks.\n    "
    bits = bits[:]
    while ((bits.len % 5) != 0):
        bits.prepend('0b0')
    while bits.startswith('0b00000'):
        if (len(bits) == 5):
            break
        bits = bits[5:]
    return bits