old_contents: # _compat_csv.py - from stdlib recipe
  
  import csv
  import codecs
  
  from ._compat import StringIO
  
  __all__ = ['unicode_csv_reader', 'UnicodeWriter']
  
  
  def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
      csv_reader = csv.reader(utf_8_encoder(unicode_csv_data), dialect=dialect, **kwargs)
      for row in csv_reader:
          yield [unicode(cell, 'utf-8') for cell in row]
  
  
  def utf_8_encoder(unicode_csv_data):
      for line in unicode_csv_data:
          yield line.encode('utf-8')
  
  
  class UnicodeWriter(object):
  
      def __init__(self, f, dialect=csv.excel, encoding='utf-8', **kwargs):
          self.queue = StringIO()
          self.writer = csv.writer(self.queue, dialect=dialect, **kwargs)
          self.stream = f
          self.encoder = codecs.getincrementalencoder(encoding)()
  
      def writerow(self, row):
          self.writer.writerow([s.encode('utf-8') for s in row])
          # Fetch UTF-8 output from the queue ...
          data = self.queue.getvalue()
          data = data.decode('utf-8')
          # ... and reencode it into the target encoding
          data = self.encoder.encode(data)
          # write to the target stream
          self.stream.write(data)
          # empty queue
          self.queue.truncate(0)
  
      def writerows(self, rows):
          for row in rows:
              self.writerow(row)
  
new_contents: # _compat_csv.py - from stdlib recipe
  
  import sys
  
  if sys.version_info < (3,):
      import csv
      import codecs
  
      from ._compat import StringIO
  
      __all__ = ['unicode_csv_reader', 'UnicodeWriter']
  
  
      def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
          csv_reader = csv.reader(utf_8_encoder(unicode_csv_data), dialect=dialect, **kwargs)
          for row in csv_reader:
              yield [unicode(cell, 'utf-8') for cell in row]
  
  
      def utf_8_encoder(unicode_csv_data):
          for line in unicode_csv_data:
              yield line.encode('utf-8')
  
  
      class UnicodeWriter(object):
  
          def __init__(self, f, dialect=csv.excel, encoding='utf-8', **kwargs):
              self.queue = StringIO()
              self.writer = csv.writer(self.queue, dialect=dialect, **kwargs)
              self.stream = f
              self.encoder = codecs.getincrementalencoder(encoding)()
  
          def writerow(self, row):
              self.writer.writerow([s.encode('utf-8') for s in row])
              # Fetch UTF-8 output from the queue ...
              data = self.queue.getvalue()
              data = data.decode('utf-8')
              # ... and reencode it into the target encoding
              data = self.encoder.encode(data)
              # write to the target stream
              self.stream.write(data)
              # empty queue
              self.queue.truncate(0)
  
          def writerows(self, rows):
              for row in rows:
                  self.writerow(row)
  
  
  else:
      __all__ = []
  
subject: move implementation to py2 branch