code: def _read_nlines(filename, nlines):
      
      if nlines < 0:
          with open(filename, 'r') as fh:
              return fh.readlines()
  
      lines = []
      with open(filename, 'r') as fh:
          for lineno, line in enumerate(fh):
              if lineno == nlines: break
              lines.append(line)
          return lines
docs: Read at most nlines lines from file filename.
      If nlines is < 0, the entire file is read.