docs: def freader(filename, gz=False, bz=False):
      """ Returns a filereader object that can handle gzipped input """
  
      filecheck(filename)
      if filename.endswith('.gz'):
          gz = True
      elif filename.endswith('.bz2'):
          bz = True
  
      if gz:
          return gzip.open(filename, 'rb')
      elif bz:
          return bz2.BZ2File(filename, 'rb')
      else:
          return io.open(filename, 'rb')