def trim_join_unit(join_unit, length):
if <NUM_LIT:0> not in join_unit.indexers:<EOL><INDENT>extra_indexers = join_unit.indexers<EOL>if join_unit.block is None:<EOL><INDENT>extra_block = None<EOL><DEDENT>else:<EOL><INDENT>extra_block = join_unit.block.getitem_block(slice(length, None))<EOL>join_unit.block = join_unit.block.getitem_block(slice(length))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>extra_block = join_unit.block<EOL>extra_indexers = copy.copy(join_unit.indexers)<EOL>extra_indexers[<NUM_LIT:0>] = extra_indexers[<NUM_LIT:0>][length:]<EOL>join_unit.indexers[<NUM_LIT:0>] = join_unit.indexers[<NUM_LIT:0>][:length]<EOL><DEDENT>extra_shape = (join_unit.shape[<NUM_LIT:0>] - length,) + join_unit.shape[<NUM_LIT:1>:]<EOL>join_unit.shape = (length,) + join_unit.shape[<NUM_LIT:1>:]<EOL>return JoinUnit(block=extra_block, indexers=extra_indexers,<EOL>shape=extra_shape)<EOL>
Reduce join_unit's shape along item axis to length.

Extra items that didn't fit are returned as a separate block.