code: def open(self, mode='read'):
          
          if self.file:
              self.close()
              raise 'Close file before opening.'
  
          if mode == 'write':
              self.file = open(self.path, 'w')
          elif mode == 'overwrite':
              # Delete file if exist.
              self.file = open(self.path, 'w+')
          else:
              # Open for reading.
              self.file = open(self.path, 'r')
  
          self._csv = csv.DictWriter(self.file,
                                     fieldnames=self.fields,
                                     delimiter=',', quotechar='|',
                                     quoting=csv.QUOTE_MINIMAL,
                                     extrasaction='ignore')
          if self.file.tell() == 0:
              self._csv.writeheader()
docs: Open the file.