def size_decode(src):
	"""
	Decodes a size (encoded with size_encode()) from the start of src.

	Returns a tuple (size, len) where size is the size that was decoded,
	and len is the number of bytes from src that were consumed.
	"""
	dstSize = 0
	pos = 0
	# Extract prefixed encoded size, if present.
	val = 1
	while True:
		c = src[pos]
		pos += 1
		if c & 0x80:
			dstSize += val * (c & 0x7f)
			break
		dstSize += val * c
		val <<= 7
	return (dstSize, pos)