<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(self):
 """ Write a new connection file to disk. and return its path """

        name = "kernel-{pid}.json".format(pid=os.getpid())
        path = os.path.join(jupyter_runtime_dir(), name)

        # indentation, because why not.
        connection_json = json.dumps(self.connection_props, indent=2)

        with open(path, "w") as connection_file:
            connection_file.write(connection_json)
        
        return path