human
Solve the following python programming problem given the following code:
def ExportToSpreadsheet(self, filename, id_key = None, content_key = None, is_csv = False) : 
    '
\t\tfilename = A tab- or comma-separated spreadsheet (utf-8 encoded, with header) containing the text corpus and all metadata
\t\t' 
    field_names = [row.field_name for row in self.db ().select (self.db.fields.field_name, orderby = self.db.fields.field_index)] 
    field_count = len (field_names) 
    all_field_names = ([(id_key if (id_key is not None) else 'doc_id'), (content_key if (content_key is not None) else 'doc_content')] + row) 
    def WriteCSV(rows) : 
        with open (filename, 'w') as f : 
            writer = UnicodeWriter (f) 
            writer.writerow (all_field_names) 
            for row in rows : 
                doc_index = row.doc_index 
                doc_id = row.doc_id 
                doc_content = self.SanitizeText (row.doc_content.decode ('utf-8')) 
                values = ([''] * field_count) 
                for d in self.db ((self.db.metadata.doc_index == doc_index)).select (self.db.metadata.field_index, self.db.metadata.value) : 
                    values [d.field_index] = self.SanitizeText (d.value.decode ('utf-8')) 
all_values = ([doc_id, doc_content] + values) 
                writer.writerow (all_values) 
def WriteTSV(rows) : 
        with open (filename, 'w') as f : 
            f.write ('{}
'.format ('\t'.join (all_field_names)).encode ('utf-8', 'ignore')) 
            for row in rows : 
                doc_index = row.doc_index 
                doc_id = row.doc_id 
                doc_content = self.SanitizeText (row.doc_content.decode ('utf-8')) 
                values = ([''] * field_count) 
                for d in self.db ((self.db.metadata.doc_index == doc_index)).select (self.db.metadata.field_index, self.db.metadata.value) : 
                    values [d.field_index] = self.SanitizeText (d.value.decode ('utf-8')) 
all_values = ([doc_id, doc_content] + values) 
                f.write ('{}
'.format ('\t'.join (all_values)).encode ('utf-8', 'ignore')) 
rows...

    
    

    Fix the buggy line: all_field_names = ([(id_key if (id_key is not None) else 'doc_id'), (content_key if (content_key is not None) else 'doc_content')] + row)
assistant
#Here is Python code to fix the buggy line: all_field_names = ([(id_key if (id_key is not None) else 'doc_id'), (content_key if (content_key is not None) else 'doc_content')] + row)
.

all_field_names = ([(id_key if (id_key is not None) else 'doc_id'), (content_key if (content_key is not None) else 'doc_content')] + field_names)