Write row to the csv file. Any unicode strings in row are encoded as
    utf-8.

def writerow(self, row):
    """Write row to the csv file. Any unicode strings in row are encoded as
    utf-8."""
    encoded_row = []
    for s in row:
      if isinstance(s, unicode):
        encoded_row.append(s.encode("utf-8"))
      else:
        encoded_row.append(s)
    try:
      self.writer.writerow(encoded_row)
    except Exception as e:
      print('error writing %s as %s' % (row, encoded_row))
      raise e