def _get_buffer(self, index):
if not <NUM_LIT:0> <= index < self.count:<EOL><INDENT>raise IndexError()<EOL><DEDENT>size = struct.calcsize(self.format)<EOL>buf = bytearray(size + <NUM_LIT:1>)<EOL>buf[<NUM_LIT:0>] = self.first_register + size * index<EOL>return buf<EOL>
Shared bounds checking and buffer creation.