<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_context(pid_file, context_info):
 """Set context of running notebook. :param context_info: dict of extra context parameters, see comm.py comments """

    assert type(context_info) == dict

    port_file = get_context_file_name(pid_file)
    with open(port_file, "wt") as f:
        f.write(json.dumps(context_info))