code: def _candidate_tempdir_list():
      
  
      dirlist = []
  
      # First, try the environment.
      for envname in 'TMPDIR', 'TEMP', 'TMP':
          dirname = _os.getenv(envname)
          if dirname: dirlist.append(dirname)
  
      # Failing that, try OS-specific locations.
      if _os.name == 'nt':
          dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
      else:
          dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
  
      # As a last resort, the current directory.
      try:
          dirlist.append(_os.getcwd())
      except (AttributeError, OSError):
          dirlist.append(_os.curdir)
  
      return dirlist
docs: Generate a list of candidate temporary directories which
      _get_default_tempdir will try.