def write(self, fptr):
self._validate(writing=True)<EOL>num_components = len(self.association)<EOL>fptr.write(struct.pack('<STR_LIT>', <NUM_LIT:8> + <NUM_LIT:2> + num_components * <NUM_LIT:6>, b'<STR_LIT>'))<EOL>fptr.write(struct.pack('<STR_LIT>', num_components))<EOL>for j in range(num_components):<EOL><INDENT>fptr.write(struct.pack('<STR_LIT:>>' + '<STR_LIT:H>' * <NUM_LIT:3>,<EOL>self.index[j],<EOL>self.channel_type[j],<EOL>self.association[j]))<EOL><DEDENT>
Write a channel definition box to file.