def build_command(self, command_name, **kwargs):
<INDENT>command_name = command_name.lower()<EOL><DEDENT>command_bitvector = bitarray(<NUM_LIT:0>, endian='<STR_LIT>')<EOL>if command_name not in self.commands:<EOL><INDENT>raise ValueError('<STR_LIT>' % command_name)<EOL><DEDENT>command_object = self.commands[command_name]<EOL>command_parts = re.split(r'<STR_LIT>', command_object['<STR_LIT>'])<EOL>for part in command_parts:  <EOL><INDENT>try:<EOL><INDENT>command_part_object = self.commands[part]<EOL><DEDENT>except KeyError:<EOL><INDENT>command_part_object = None<EOL><DEDENT>if command_part_object and '<STR_LIT>'in command_part_object:  <EOL><INDENT>if string_is_binary(command_part_object['<STR_LIT>']):<EOL><INDENT>command_bitvector += bitarray(command_part_object['<STR_LIT>'], endian='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>command_bitvector += self.build_command(part, **kwargs)<EOL><DEDENT><DEDENT>elif command_part_object:  <EOL><INDENT>if part in kwargs:<EOL><INDENT>value = kwargs[part]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % part)<EOL><DEDENT>try:<EOL><INDENT>command_bitvector += value<EOL><DEDENT>except TypeError:  <EOL><INDENT>if string_is_binary(value):<EOL><INDENT>value = int(value, <NUM_LIT:2>)<EOL><DEDENT>try:<EOL><INDENT>command_bitvector += bitarray_from_value(value=int(value), size=command_part_object['<STR_LIT>'], fmt='<STR_LIT:I>')<EOL><DEDENT>except Exception:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>elif string_is_binary(part):<EOL><INDENT>command_bitvector += bitarray(part, endian='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % part)<EOL><DEDENT><DEDENT>if command_bitvector.length() != command_object['<STR_LIT>']:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if command_bitvector.length() == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return command_bitvector<EOL>
build command from command_name and keyword values

        Returns
        -------
        command_bitvector : list
            List of bitarrays.

        Usage
        -----
        Receives: command name as defined inside xml file, key-value-pairs as defined inside bit stream filed for each command