def get_row(line_contents, column_names):
 row = []
 for column_name in column_names:
  line_value = get_nested_value(line_contents, column_name)
  if isinstance(line_value, unicode):
   row.append('{0}'.format(line_value.encode('utf-8')))
  elif (line_value is not None):
   row.append('{0}'.format(line_value))
  else:
   row.append('')
 return row

def get_row ( line_contents , column_names ) : row = [ ] for column_name in column_names : line_value = get_nested_value ( line_contents , column_name ) if isinstance ( line_value , unicode ) : row . append ( '{0}' . format ( line_value . encode ( 'utf-8' ) ) ) elif ( line_value is not None ) : row . append ( '{0}' . format ( line_value ) ) else : row . append ( '' ) return row
return a csv compatible row given column names and a dict .