Replace **locals() with explicit field names.
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index fd39ca8..8671330 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -288,9 +288,6 @@
         seen_names.add(name)
 
     # Create and fill-in the class template
-    numfields = len(field_names)
-    argtxt = repr(field_names).replace("'", "")[1:-1]   # tuple repr without parens or quotes
-    reprtxt = ', '.join('{}=%r'.format(name) for name in field_names)
     template = '''class {typename}(tuple):
         '{typename}({argtxt})'
 
@@ -329,7 +326,14 @@
             'Return self as a plain tuple.  Used by copy and pickle.'
             return tuple(self)
 
-'''.format(**locals())
+'''
+    template = template.format(
+        typename = typename,
+        field_names = field_names,
+        argtxt = repr(field_names).replace("'", "")[1:-1],
+        numfields = len(field_names),
+        reprtxt = ', '.join('{}=%r'.format(name) for name in field_names),
+    )
     for i, name in enumerate(field_names):
         template += "        %s = _property(_itemgetter(%d), doc='Alias for field number %d')\n" % (name, i, i)
     if verbose: