def __get_batch(self, path, length, last=False):
import tables<EOL>h5_file = tables.open_file(self.filename, '<STR_LIT:r>')<EOL>h5_node = h5_file.get_node(path)<EOL>if len(h5_node) == <NUM_LIT:0>:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if length is None:<EOL><INDENT>chunkshape = h5_node.chunkshape<EOL>if chunkshape is None:<EOL><INDENT>default_length = <NUM_LIT>*<NUM_LIT:2>**<NUM_LIT:10>//h5_node[<NUM_LIT:0>].nbytes  <EOL>length = min(h5_node.shape[<NUM_LIT:0>], default_length)<EOL><DEDENT>else:<EOL><INDENT>length = chunkshape[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if last:<EOL><INDENT>example = h5_node[length*(len(h5_node)//length):].copy()<EOL><DEDENT>else:<EOL><INDENT>example = h5_node[:length].copy()<EOL><DEDENT>h5_file.close()<EOL>return example<EOL>
Get a block of data from the node at path.

:param path: The path to the node to read from.
:param length: The length along the outer dimension to read.
:param last: True if the remainder elements should be read.
:return: A copy of the requested block of data as a numpy array.