import gzip


def read_file(filename):
 """ Read file into a list of strings, uncluding direct reading of ".gz" files
 Different operations required for gzip files in Python 3 because they are
 read as binary (rather than text) files
 """
    
 #If the first file is a gzipped file, open it via the gzip module
 if(filename.find(".gz") != -1):
   F=gzip.open(filename)
   filedata = [l.decode() for l in F.readlines() ] 
   F.close()
 #Otherwise open as normal
 else:
   F=open(filename);
   filedata = F.readlines();
   F.close()

 if ".restart" in filename:
  filedata = filedata[1:]

 return filedata