'Render metadata block as a byte string.'

@classmethod
def _writeblocks(cls, blocks, available, cont_size, padding_func):

    data = bytearray()
    for block in blocks:
        if isinstance(block, Padding):
            continue
        data += cls._writeblock(block)
    blockssize = len(data)
    padding_block = Padding()
    blockssize += len(cls._writeblock(padding_block))
    info = PaddingInfo((available - blockssize), cont_size)
    padding_block.length = min(info._get_padding(padding_func), cls._MAX_SIZE)
    data += cls._writeblock(padding_block, is_last=True)
    return data
