<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_json(self, path, contents, message):
 """Write json to disk. Args: path (str):
 the path to write to contents (dict):
 the contents of the json blob message (str):
 the message to log """

        log.debug(message.format(path=path))
        makedirs(os.path.dirname(path))
        with open(path, "w") as fh:
            json.dump(contents, fh, indent=2, sort_keys=True)