code: def prepend_line(filepath, line):
      
      with open(filepath) as f:
          lines = f.readlines()
  
      lines.insert(0, line)
  
      with open(filepath, 'w') as f:
          f.writelines(lines)
docs: Rewrite a file adding a line to its beginning.