new_contents: import tempfile
  from contextlib import contextmanager
  import os
  import zlib
  
  
  @contextmanager
  def make_file(contents, suffix, decompress=False):
      """Context manager to write data to a temporary file,
      and delete on exit
  
      :param contents: Data to write. string
      :param suffix: File suffix. string
      """
      if decompress:
          contents = zlib.decompress(contents)
  
      try:
          _, fname = tempfile.mkstemp(suffix=suffix)
          with open(fname, 'wb') as infile:
              infile.write(contents)
          yield fname
      finally:
          os.unlink(fname)
  
subject: test refactor