def registration_codes_csv(file_name, codes_list, csv_type=None):
 query_features = ['code', 'redeem_code_url', 'course_id', 'company_name', 'created_by', 'redeemed_by', 'invoice_id', 'purchaser', 'customer_reference_number', 'internal_reference', 'is_valid']
 registration_codes = instructor_analytics.basic.course_registration_features(query_features, codes_list, csv_type)
 (header, data_rows) = instructor_analytics.csvs.format_dictlist(registration_codes, query_features)
 return instructor_analytics.csvs.create_csv_response(file_name, header, data_rows)

def registration_codes_csv ( file_name , codes_list , csv_type = None ) : query_features = [ 'code' , 'redeem_code_url' , 'course_id' , 'company_name' , 'created_by' , 'redeemed_by' , 'invoice_id' , 'purchaser' , 'customer_reference_number' , 'internal_reference' , 'is_valid' ] registration_codes = instructor_analytics . basic . course_registration_features ( query_features , codes_list , csv_type ) ( header , data_rows ) = instructor_analytics . csvs . format_dictlist ( registration_codes , query_features ) return instructor_analytics . csvs . create_csv_response ( file_name , header , data_rows )
respond with the csv headers and data rows given a dict of codes list .