code: def write_if_different(filename, data):
      
  
      assert isinstance(data, bytes)
  
      if os.path.exists(filename):
          with open(filename, 'rb') as fd:
              original_data = fd.read()
      else:
          original_data = None
  
      if original_data != data:
          with open(filename, 'wb') as fd:
              fd.write(data)
docs: Write `data` to `filename`, if the content of the file is different.
  
      Parameters
      ----------
      filename : str
          The file name to be written to.
      data : bytes
          The data to be written to `filename`.