def get_commands(self, command_name, **kwargs):
chip_id = kwargs.pop("<STR_LIT>", self.chip_id_bitarray)<EOL>commands = []<EOL>if command_name == "<STR_LIT>":<EOL><INDENT>bv = bitarray(endian='<STR_LIT>')<EOL>if "<STR_LIT>" in kwargs:<EOL><INDENT>bv += bitarray(kwargs["<STR_LIT>"], endian='<STR_LIT>')  <EOL><DEDENT>elif kwargs:<EOL><INDENT>raise ValueError("<STR_LIT>" % "<STR_LIT:U+002CU+0020>".join(kwargs.iterkeys()))<EOL><DEDENT>bv.setall(<NUM_LIT:0>)  <EOL>commands.append(bv)<EOL><DEDENT>elif command_name == "<STR_LIT>":<EOL><INDENT>bv = bitarray(endian='<STR_LIT>')<EOL>if "<STR_LIT>" in kwargs:<EOL><INDENT>bv += bitarray(kwargs["<STR_LIT>"], endian='<STR_LIT>')  <EOL><DEDENT>elif kwargs:<EOL><INDENT>raise ValueError("<STR_LIT>" % "<STR_LIT:U+002CU+0020>".join(kwargs.iterkeys()))<EOL><DEDENT>bv.setall(<NUM_LIT:1>)  <EOL>commands.append(bv)<EOL><DEDENT>elif command_name == "<STR_LIT>":<EOL><INDENT>register_addresses = self.get_global_register_attributes("<STR_LIT>", **kwargs)<EOL>register_bitsets = self.get_global_register_bitsets(register_addresses)<EOL>commands.extend([self.build_command(command_name, Address=register_address, GlobalData=register_bitset, ChipID=chip_id, **kwargs) for register_address, register_bitset in zip(register_addresses, register_bitsets)])<EOL><DEDENT>elif command_name == "<STR_LIT>":<EOL><INDENT>register_addresses = self.get_global_register_attributes('<STR_LIT>', **kwargs)<EOL>commands.extend([self.build_command(command_name, Address=register_address, ChipID=chip_id) for register_address in register_addresses])<EOL><DEDENT>elif command_name == "<STR_LIT>":<EOL><INDENT>registers = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>if self.fei4a:<EOL><INDENT>registers.append("<STR_LIT>")<EOL><DEDENT>elif self.fei4b:<EOL><INDENT>registers.append("<STR_LIT>")<EOL><DEDENT>self.create_restore_point()<EOL>dcs = kwargs.pop("<STR_LIT>", range(<NUM_LIT>))  <EOL>if not dcs:<EOL><INDENT>dcs = range(<NUM_LIT>)<EOL><DEDENT>joint_write = kwargs.pop("<STR_LIT>", False)<EOL>same_mask_for_all_dc = kwargs.pop("<STR_LIT>", False)<EOL>register_objects = self.get_pixel_register_objects(do_sort=['<STR_LIT>'], **kwargs)<EOL>if not self.broadcast:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)  <EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT>)  <EOL><INDENT>commands.extend(self.get_commands("<STR_LIT>", ChipID=<NUM_LIT:8>))  <EOL><DEDENT>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>"], ChipID=<NUM_LIT:8>))  <EOL><DEDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:3> if same_mask_for_all_dc else <NUM_LIT:0>)  <EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>if self.fei4a:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL><DEDENT>elif self.fei4b:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL><DEDENT>commands.extend(self.get_commands("<STR_LIT>", name=registers))<EOL>if joint_write:<EOL><INDENT>pxstrobes = <NUM_LIT:0><EOL>first_read = True<EOL>do_latch = False<EOL>for register_object in register_objects:<EOL><INDENT>if register_object['<STR_LIT>'] != <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>' % register_object['<STR_LIT:name>'])<EOL><DEDENT>pxstrobe = register_object['<STR_LIT>']<EOL>if not isinstance(pxstrobe, basestring):<EOL><INDENT>do_latch = True<EOL>pxstrobes += <NUM_LIT:2> ** register_object['<STR_LIT>']<EOL><DEDENT>if first_read:<EOL><INDENT>pixel_reg_value = register_object['<STR_LIT:value>']<EOL>first_read = False<EOL><DEDENT>else:<EOL><INDENT>if np.array_equal(pixel_reg_value, register_object['<STR_LIT:value>']):<EOL><INDENT>pixel_reg_value = register_object['<STR_LIT:value>']<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % register_object['<STR_LIT:name>'])<EOL><DEDENT><DEDENT><DEDENT>if do_latch:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL><DEDENT>self.set_global_register_value("<STR_LIT>", pxstrobes)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>"]))<EOL>for dc_no in (dcs[:<NUM_LIT:1>] if same_mask_for_all_dc else dcs):<EOL><INDENT>self.set_global_register_value("<STR_LIT>", dc_no)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL>register_bitset = self.get_pixel_register_bitset(register_objects[<NUM_LIT:0>], <NUM_LIT:0>, dc_no)<EOL>commands.extend([self.build_command(command_name, PixelData=register_bitset, ChipID=<NUM_LIT:8>, **kwargs)])  <EOL>if do_latch:<EOL><INDENT>commands.extend(self.get_commands("<STR_LIT>", Width=<NUM_LIT:0>))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for register_object in register_objects:<EOL><INDENT>pxstrobe = register_object['<STR_LIT>']<EOL>if isinstance(pxstrobe, basestring):<EOL><INDENT>do_latch = False<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)  <EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>"]))<EOL><DEDENT>else:<EOL><INDENT>do_latch = True<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL><DEDENT>bitlength = register_object['<STR_LIT>']<EOL>for bit_no, pxstrobe_bit_no in (enumerate(range(bitlength)) if (register_object['<STR_LIT>'] is False) else enumerate(reversed(range(bitlength)))):<EOL><INDENT>if do_latch:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:2> ** (pxstrobe + bit_no))<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL><DEDENT>for dc_no in (dcs[:<NUM_LIT:1>] if same_mask_for_all_dc else dcs):<EOL><INDENT>self.set_global_register_value("<STR_LIT>", dc_no)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL>register_bitset = self.get_pixel_register_bitset(register_object, pxstrobe_bit_no, dc_no)<EOL>commands.extend([self.build_command(command_name, PixelData=register_bitset, ChipID=<NUM_LIT:8>, **kwargs)])  <EOL>if do_latch:<EOL><INDENT>commands.extend(self.get_commands("<STR_LIT>", Width=<NUM_LIT:0>))<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>self.restore(pixel_register=False)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=registers))<EOL><DEDENT>elif command_name == "<STR_LIT>":<EOL><INDENT>registers = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>if self.fei4a:<EOL><INDENT>registers.append("<STR_LIT>")<EOL><DEDENT>elif self.fei4b:<EOL><INDENT>registers.append("<STR_LIT>")<EOL><DEDENT>self.create_restore_point()<EOL>dcs = kwargs.pop("<STR_LIT>", range(<NUM_LIT>))  <EOL>if not dcs:<EOL><INDENT>dcs = range(<NUM_LIT>)<EOL><DEDENT>register_objects = self.get_pixel_register_objects(**kwargs)<EOL>self.set_global_register_value('<STR_LIT>', <NUM_LIT:1>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>if self.fei4b:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL><DEDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>if self.fei4a:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL><DEDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)  <EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=registers))<EOL>for index, register_object in enumerate(register_objects):  <EOL><INDENT>if register_object['<STR_LIT:name>'] == '<STR_LIT>':<EOL><INDENT>register_objects[<NUM_LIT:0>], register_objects[index] = register_objects[index], register_objects[<NUM_LIT:0>]<EOL>break<EOL><DEDENT><DEDENT>for register_object in register_objects:<EOL><INDENT>pxstrobe = register_object['<STR_LIT>']<EOL>bitlength = register_object['<STR_LIT>']<EOL>for pxstrobe_bit_no in range(bitlength):<EOL><INDENT>logging.debug('<STR_LIT>', register_object['<STR_LIT:name>'], pxstrobe_bit_no)<EOL>do_latch = True<EOL>try:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:2> ** (pxstrobe + pxstrobe_bit_no))<EOL><DEDENT>except TypeError:  <EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)  <EOL>do_latch = False<EOL><DEDENT>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL>for dc_no in dcs:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", dc_no)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL>if do_latch is True:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]))<EOL>commands.extend(self.get_commands("<STR_LIT>", Width=<NUM_LIT:0>))<EOL><DEDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]))<EOL>register_bitset = self.get_pixel_register_bitset(register_object, pxstrobe_bit_no if (register_object['<STR_LIT>'] is False) else register_object['<STR_LIT>'] - pxstrobe_bit_no - <NUM_LIT:1>, dc_no)<EOL>if self.fei4b:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:1>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL><DEDENT>commands.extend([self.build_command("<STR_LIT>", PixelData=register_bitset, ChipID=chip_id)])<EOL>if self.fei4b:<EOL><INDENT>self.set_global_register_value("<STR_LIT>", <NUM_LIT:0>)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=["<STR_LIT>"]))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>self.restore(pixel_register=False)<EOL>commands.extend(self.get_commands("<STR_LIT>", name=registers))<EOL><DEDENT>else:<EOL><INDENT>commands.append(self.build_command(command_name, ChipID=chip_id, **kwargs))<EOL><DEDENT>return commands<EOL>
get fe_command from command name and keyword arguments

        wrapper for build_commands()
        implements FEI4 specific behavior