diff --git a/libsel4test/tools/extract_results.py b/libsel4test/tools/extract_results.py
index e57e469..8cc9b0a 100755
--- a/libsel4test/tools/extract_results.py
+++ b/libsel4test/tools/extract_results.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
-#  Copyright 2017, Data61
+#  Copyright 2020, Data61
 #  Commonwealth Scientific and Industrial Research Organisation (CSIRO)
 #  ABN 41 687 119 230.
 #
@@ -9,22 +9,27 @@
 #  See "LICENSE_BSD2.txt" for details.
 #
 #  @TAG(DATA61_BSD)
-import argparse, bs4, functools, re, sys
+import argparse
+import bs4
+import functools
+import re
+import sys
 
 SYS_OUT = 'system-out'
-XML_SPECIAL_CHARS = {'<':"&lt;",'&':"&amp;",'>':"&gt;",'"':"&quot;","'":"&apos;"}
+XML_SPECIAL_CHARS = {'<': "&lt;", '&': "&amp;", '>': "&gt;", '"': "&quot;", "'": "&apos;"}
 
 TAG_WHITELIST = {
     # Keys are tags to be emitted, values are whether to emit their inner text.
-    'error':True,
-    'failure':True,
-    'testsuite':False,
-    'testcase':False,
-    SYS_OUT:True,
+    'error': True,
+    'failure': True,
+    'testsuite': False,
+    'testcase': False,
+    SYS_OUT: True,
 }
 
 TOP_TAG = 'testsuite'
 
+
 def print_tag(f, tag):
     assert isinstance(tag, bs4.element.Tag)
 
@@ -35,51 +40,50 @@
     # If we want the inner text, just blindly dump the soup.
     if TAG_WHITELIST[tag.name]:
         if tag.name != SYS_OUT:
-            print >>f, tag
+            print(tag, file=f)
         else:
-            print >>f, '<%s>' % tag.name
+            print('<%s>' % tag.name, file=f)
             text = tag.get_text()
             for ch in text:
                 if ch not in XML_SPECIAL_CHARS:
                     f.write(ch)
                 else:
                     f.write(XML_SPECIAL_CHARS[ch])
-            print >>f, '</%s>' % tag.name
+            print('</%s>' % tag.name, file=f)
     else:
-        print >>f, '<%(name)s %(attrs)s>' % {
-            'name':tag.name,
-            'attrs':' '.join(map(lambda x: '%s="%s"' % (x[0], x[1]),
-                tag.attrs.items())),
-        }
+        print('<%(name)s %(attrs)s>' % {
+            'name': tag.name,
+            'attrs': ' '.join(['%s="%s"' % (x[0], x[1]) for x in list(tag.attrs.items())]),
+        }, file=f)
 
         # Recurse for our children.
-        map(functools.partial(print_tag, f),
-            filter(lambda x: isinstance(x, bs4.element.Tag),
-                tag.children))
+        list(map(functools.partial(print_tag, f),
+                 [x for x in tag.children if isinstance(x, bs4.element.Tag)]))
 
-        print >>f, '</%s>' % tag.name
+        print('</%s>' % tag.name, file=f)
+
 
 def main():
     parser = argparse.ArgumentParser('Cleanup messy XML output from sel4test')
     parser.add_argument('input',
-        nargs='?', help='Input file', type=argparse.FileType('r'),
-        default=sys.stdin)
+                        nargs='?', help='Input file', type=argparse.FileType('r'),
+                        default=sys.stdin)
     parser.add_argument('output',
-        nargs='?', help='Output file', type=argparse.FileType('w'),
-        default=sys.stdout)
+                        nargs='?', help='Output file', type=argparse.FileType('w'),
+                        default=sys.stdout)
     parser.add_argument('--quiet', '-q',
-        help='Suppress unmodified output to stdout', action='store_true',
-        default=False)
+                        help='Suppress unmodified output to stdout', action='store_true',
+                        default=False)
     args = parser.parse_args()
 
     data = args.input.read()
 
     # Strip trailing crap around the XML we want to parse. Without this, even
     # BeautifulSoup sometimes backs away in horror.
-    regexp = re.compile(r'(<%(top)s>.*</%(top)s>)' % {'top':TOP_TAG}, re.S)
+    regexp = re.compile(r'(<%(top)s>.*</%(top)s>)' % {'top': TOP_TAG}, re.S)
     matches = re.search(regexp, data)
     if not matches or len(matches.groups()) != 1:
-        print >>sys.stderr, 'Failed to strip leading and trailing garbage'
+        print('Failed to strip leading and trailing garbage', file=sys.stderr)
         return -1
     data = matches.group(0)
 
@@ -87,28 +91,29 @@
     # means end users have a chance of determining what went wrong from the
     # original output.
     if not args.quiet:
-        print data
+        print(data)
 
     # Parse the input as HTML even though BS supports XML. It seems the XML
     # parser is a bit more precious about the input.
     try:
         soup = bs4.BeautifulSoup(data, "lxml")
     except Exception as inst:
-        print >>sys.stderr, 'Failed to parse input: %s' % inst
+        print('Failed to parse input: %s' % inst, file=sys.stderr)
         return -1
 
     try:
         top = soup.find_all(TOP_TAG)[0]
     except Exception as inst:
-        print >>sys.stderr, 'Failed to find initial %s tag: %s' % (TOP_TAG, inst)
+        print('Failed to find initial %s tag: %s' % (TOP_TAG, inst), file=sys.stderr)
         return -1
 
     try:
         print_tag(args.output, top)
     except Exception as inst:
-        print >>sys.stderr, 'While navigating XML: %s' % inst
+        print('While navigating XML: %s' % inst, file=sys.stderr)
 
     return 0
 
+
 if __name__ == '__main__':
     sys.exit(main())
