def start_file(fname, id_=None):
 if isinstance(fname, string_types):
  if (op.splitext(fname)[1].lower() == '.gz'):
   logger.debug('Writing using gzip')
   fid = GzipFile(fname, 'wb', compresslevel=2)
  else:
   logger.debug('Writing using normal I/O')
   fid = open(fname, 'wb')
 else:
  logger.debug(('Writing using %s I/O' % type(fname)))
  fid = fname
  fid.seek(0)
 write_id(fid, FIFF.FIFF_FILE_ID, id_)
 write_int(fid, FIFF.FIFF_DIR_POINTER, (-1))
 write_int(fid, FIFF.FIFF_FREE_LIST, (-1))
 return fid

def start_file ( fname , id_ = None ) : if isinstance ( fname , string_types ) : if ( op . splitext ( fname ) [ 1 ] . lower ( ) == '.gz' ) : logger . debug ( 'Writing using gzip' ) fid = GzipFile ( fname , 'wb' , compresslevel = 2 ) else : logger . debug ( 'Writing using normal I/O' ) fid = open ( fname , 'wb' ) else : logger . debug ( ( 'Writing using %s I/O' % type ( fname ) ) ) fid = fname fid . seek ( 0 ) write_id ( fid , FIFF . FIFF_FILE_ID , id_ ) write_int ( fid , FIFF . FIFF_DIR_POINTER , ( - 1 ) ) write_int ( fid , FIFF . FIFF_FREE_LIST , ( - 1 ) ) return fid
generalized os .