<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(file_name, data):
 """Encode and write a Hip file."""

    with open(file_name, 'w') as f:
        f.write(encode(data))