<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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