code: def write(self, dry_run=True):
      
      start_lines = self._build_file_source_lines[:]
      end_lines = self.build_file_lines()
      diff_generator = unified_diff(start_lines,
                                    end_lines,
                                    fromfile=self.build_file.relpath,
                                    tofile=self.build_file.relpath,
                                    lineterm='')
      if dry_run:
        msg = 'DRY RUN, would have written this diff:'
      else:
        msg = 'REAL RUN, about to write the following diff:'
      sys.stderr.write(msg + '\n')
      sys.stderr.write('*' * 40 + '\n')
      sys.stderr.write('target at: ')
      sys.stderr.write(str(self.target_address) + '\n')
  
      for line in diff_generator:
        sys.stderr.write(line + '\n')
  
      sys.stderr.write('*' * 40 + '\n')
      if not dry_run:
        with open(self.build_file.full_path, 'w') as bf:
          bf.write('\n'.join(end_lines))
        sys.stderr.write('WROTE to {full_path}\n'.format(full_path=self.build_file.full_path))
docs: Write out the changes made to the BUILD file, and print the diff to stderr.
  
      :param dry_run: Don't actually write out the BUILD file, but do print the diff to stderr.