code: def open(self, encoding=None):
          
          try:
              if IS_GZIPPED_FILE.search(self._filename):
                  _file = gzip.open(self._filename, 'rb')
              else:
                  if encoding:
                      _file = io.open(self._filename, 'r', encoding=encoding, errors='replace')
                  elif self._encoding:
                      _file = io.open(self._filename, 'r', encoding=self._encoding, errors='replace')
                  else:
                      _file = io.open(self._filename, 'r', errors='replace')
          except IOError, e:
              self._log_warning(str(e))
              _file = None
              self.close()
  
          return _file
docs: Opens the file with the appropriate call