code: def gettemp(content=None, dir=None, prefix="tmp", suffix="tmp"):
      
      if dir is not None:
          if not os.path.exists(dir):
              os.makedirs(dir)
      fh, path = tempfile.mkstemp(dir=dir, prefix=prefix, suffix=suffix)
      _tmp_paths.append(path)
      if content:
          fh = os.fdopen(fh, "wb")
          if hasattr(content, 'encode'):
              content = content.encode('utf8')
          fh.write(content)
          fh.close()
      return path
docs: Create temporary file with the given content.
  
      Please note: the temporary file must be deleted by the caller.
  
      :param string content: the content to write to the temporary file.
      :param string dir: directory where the file should be created
      :param string prefix: file name prefix
      :param string suffix: file name suffix
      :returns: a string with the path to the temporary file