code: def make_directory_entry(d):
      
      assert d['path'].endswith('.directory')
  
      # default values
      d.setdefault('comment', '')
      d.setdefault('icon', '')
  
      fo = open(d['path'], "w")
      fo.write("""\
  [Desktop Entry]
  Type=Directory
  Encoding=UTF-8
  Name=%(name)s
  Comment=%(comment)s
  Icon=%(icon)s
  """ % d)
      fo.close()
docs: Create a directory entry that conforms to the format of the Desktop Entry
      Specification by freedesktop.org.  See:
              http://freedesktop.org/Standards/desktop-entry-spec
      These should work for both KDE and Gnome2
  
      An entry is a .directory file that includes the display name, icon, etc.
      It will be placed in the location specified within the passed dict.  The
      filename can be explicitly specified, but if not provided, will default to
      an escaped version of the name.