Run 2to3 over Doc/tools/.
diff --git a/Doc/tools/sgmlconv/docfixer.py b/Doc/tools/sgmlconv/docfixer.py
index 961e3b8..9f93966 100755
--- a/Doc/tools/sgmlconv/docfixer.py
+++ b/Doc/tools/sgmlconv/docfixer.py
@@ -210,8 +210,7 @@
     # 2a.
     if descriptor.hasAttribute("var"):
         if descname != "opcodedesc":
-            raise RuntimeError, \
-                  "got 'var' attribute on descriptor other than opcodedesc"
+            raise RuntimeError("got 'var' attribute on descriptor other than opcodedesc")
         variable = descriptor.getAttribute("var")
         if variable:
             args = doc.createElement("args")
@@ -241,7 +240,7 @@
             try:
                 sig = methodline_to_signature(doc, children[pos])
             except KeyError:
-                print oldchild.toxml()
+                print(oldchild.toxml())
                 raise
             newchildren.append(sig)
         else:
@@ -347,7 +346,7 @@
     while queue:
         node = queue[0]
         del queue[0]
-        if wsmap.has_key(node.nodeName):
+        if node.nodeName in wsmap:
             fixups.append(node)
         for child in node.childNodes:
             if child.nodeType == ELEMENT:
@@ -962,8 +961,7 @@
             gi = node.tagName
             if knownempty(gi):
                 if node.hasChildNodes():
-                    raise ValueError, \
-                          "declared-empty node <%s> has children" % gi
+                    raise ValueError("declared-empty node <%s> has children" % gi)
                 ofp.write("e\n")
             for k, value in node.attributes.items():
                 if _token_rx.match(value):
@@ -979,7 +977,7 @@
         elif nodeType == ENTITY_REFERENCE:
             ofp.write("&%s\n" % node.nodeName)
         else:
-            raise RuntimeError, "unsupported node type: %s" % nodeType
+            raise RuntimeError("unsupported node type: %s" % nodeType)
 
 
 def convert(ifp, ofp):
@@ -1033,7 +1031,7 @@
     for gi in events.parser.get_empties():
         d[gi] = gi
     for key in ("author", "pep", "rfc"):
-        if d.has_key(key):
+        if key in d:
             del d[key]
     knownempty = d.has_key
     #
diff --git a/Doc/tools/sgmlconv/esis2sgml.py b/Doc/tools/sgmlconv/esis2sgml.py
index 81294d1..10ec83a 100755
--- a/Doc/tools/sgmlconv/esis2sgml.py
+++ b/Doc/tools/sgmlconv/esis2sgml.py
@@ -44,8 +44,7 @@
 
 
 def format_attrs(attrs, xml=0):
-    attrs = attrs.items()
-    attrs.sort()
+    attrs = sorted(attrs.items())
     parts = []
     append = parts.append
     for name, value in attrs:
@@ -149,7 +148,7 @@
             ofp.write("&%s;" % data)
             knownempty = 0
         else:
-            raise RuntimeError, "unrecognized ESIS event type: '%s'" % type
+            raise RuntimeError("unrecognized ESIS event type: '%s'" % type)
 
     if LIST_EMPTIES:
         dump_empty_element_names(knownempties)
@@ -170,8 +169,7 @@
             if gi:
                 d[gi] = gi
     fp = open(EMPTIES_FILENAME, "w")
-    gilist = d.keys()
-    gilist.sort()
+    gilist = sorted(d.keys())
     fp.write("\n".join(gilist))
     fp.write("\n")
     fp.close()
diff --git a/Doc/tools/sgmlconv/esistools.py b/Doc/tools/sgmlconv/esistools.py
index 6dc5eaa..11f458e 100644
--- a/Doc/tools/sgmlconv/esistools.py
+++ b/Doc/tools/sgmlconv/esistools.py
@@ -29,7 +29,7 @@
             n, s = s.split(";", 1)
             r = r + unichr(int(n))
         else:
-            raise ValueError, "can't handle %r" % s
+            raise ValueError("can't handle %r" % s)
     return r
 
 
@@ -80,7 +80,7 @@
             self.setErrorHandler(errorHandler)
 
     def get_empties(self):
-        return self._empties.keys()
+        return list(self._empties.keys())
 
     #
     #  XMLReader interface
@@ -270,7 +270,7 @@
         return self._attrs[name][0]
 
     def get(self, name, default=None):
-        if self._attrs.has_key(name):
+        if name in self._attrs:
             return self._attrs[name][0]
         return default
 
@@ -282,7 +282,7 @@
 
     def values(self):
         L = []
-        for value, type in self._attrs.values():
+        for value, type in list(self._attrs.values()):
             L.append(value)
         return L
 
diff --git a/Doc/tools/sgmlconv/latex2esis.py b/Doc/tools/sgmlconv/latex2esis.py
index cbc9828..3ee86e3 100755
--- a/Doc/tools/sgmlconv/latex2esis.py
+++ b/Doc/tools/sgmlconv/latex2esis.py
@@ -472,7 +472,7 @@
         name = attrs["name"]
         self.__current = TableEntry(name, environment=1)
         self.__current.verbatim = attrs.get("verbatim") == "yes"
-        if attrs.has_key("outputname"):
+        if "outputname" in attrs:
             self.__current.outputname = attrs.get("outputname")
         self.__current.endcloses = attrs.get("endcloses", "").split()
     def end_environment(self):
@@ -482,11 +482,11 @@
         name = attrs["name"]
         self.__current = TableEntry(name)
         self.__current.closes = attrs.get("closes", "").split()
-        if attrs.has_key("outputname"):
+        if "outputname" in attrs:
             self.__current.outputname = attrs.get("outputname")
     def end_macro(self):
         name = self.__current.name
-        if self.__table.has_key(name):
+        if name in self.__table:
             raise ValueError("name %r already in use" % (name,))
         self.__table[name] = self.__current
         self.__current = None