def encode_uvarint(number: int) ->bytes:
    """Pack `number` into varint bytes."""
    buf = b''
    while True:
        towrite = number & 127
        number >>= 7
        if number:
            buf += bytes((towrite | 128,))
        else:
            buf += bytes((towrite,))
            break
    return buf
