'Returns the block content + header.
Raises error.'

@classmethod
def _writeblock(cls, block, is_last=False):

    data = bytearray()
    code = ((block.code | 128) if is_last else block.code)
    datum = block.write()
    size = len(datum)
    if (size > cls._MAX_SIZE):
        if (block._distrust_size and (block._invalid_overflow_size != (-1))):
            size = block._invalid_overflow_size
        else:
            raise error('block    is    too    long    to    write')
    assert (not (size > cls._MAX_SIZE))
    length = struct.pack('>I', size)[(-3):]
    data.append(code)
    data += length
    data += datum
    return data
