<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def writefile(openedfile, newcontents):
 """Set the contents of a file."""

    openedfile.seek(0)
    openedfile.truncate()
    openedfile.write(newcontents)