code: def writeHeader(self, out, size=999):
          
  
          def defaultkey(d, key, value):
              """Add ``[key]==value`` to the dictionary `d`, but only if
              it does not have that key already.
              """
  
              if key in d:
                  return
              d[key] = value
  
          z = '\x00' * 4
          defaults = dict(preferredCMM=z,
                          version='02000000',
                          profileclass=z,
                          colourspace=z,
                          pcs='XYZ ',
                          created=writeICCdatetime(),
                          acsp='acsp',
                          platform=z,
                          flag=0,
                          manufacturer=z,
                          model=0,
                          deviceattributes=0,
                          intent=0,
                          pcsilluminant=encodefuns()['XYZ'](*D50()),
                          creator=z,
                          )
          for k, v in defaults.items():
              defaultkey(self.d, k, v)
  
          hl = map(self.d.__getitem__,
                   ['preferredCMM', 'version', 'profileclass', 'colourspace',
                    'pcs', 'created', 'acsp', 'platform', 'flag',
                    'manufacturer', 'model', 'deviceattributes', 'intent',
                    'pcsilluminant', 'creator'])
          # Convert to struct.pack input
          hl[1] = int(hl[1], 16)
  
          out.write(struct.pack('>L4sL4s4s4s12s4s4sL4sLQL12s4s', size, *hl))
          out.write('\x00' * 44)
          return self
docs: Add default values to the instance's `d` dictionary, then
          write a header out onto the file stream.  The size of the
          profile must be specified using the `size` argument.