'Open file and write prolog.'

def initialize_export(self, filename, bulkload_state):

    self.bulkload_state = bulkload_state
    mode = 'w'
    if (self.mode == 'binary'):
        mode = 'wb'
    self.export_file_pointer = open(filename, mode)
    if self.prolog:
        self.export_file_pointer.write(self.prolog)
        if (self.mode == 'text'):
            self.export_file_pointer.write('\n')
