def _validate_precinct_size(self, cparams):
code_block_specified = False<EOL>if cparams.cblockw_init != <NUM_LIT:0> and cparams.cblockh_init != <NUM_LIT:0>:<EOL><INDENT>code_block_specified = True<EOL><DEDENT>if cparams.res_spec != <NUM_LIT:0>:<EOL><INDENT>for j in range(cparams.res_spec):<EOL><INDENT>prch = cparams.prch_init[j]<EOL>prcw = cparams.prcw_init[j]<EOL>if j == <NUM_LIT:0> and code_block_specified:<EOL><INDENT>height, width = cparams.cblockh_init, cparams.cblockw_init<EOL>if prch < height * <NUM_LIT:2> or prcw < width * <NUM_LIT:2>:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>msg = msg.format(prch=prch, prcw=prcw,<EOL>cbh=height, cbw=width)<EOL>raise IOError(msg)<EOL><DEDENT><DEDENT>if ((math.log(prch, <NUM_LIT:2>) != math.floor(math.log(prch, <NUM_LIT:2>)) or<EOL>math.log(prcw, <NUM_LIT:2>) != math.floor(math.log(prcw, <NUM_LIT:2>)))):<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>msg = msg.format(height=prch, width=prcw)<EOL>raise IOError(msg)<EOL><DEDENT><DEDENT><DEDENT>
Precinct dimensions must satisfy certain restrictions if specified.

They must both be a power of 2 and must both be at least twice the
size of their codeblock size counterparts.