<｜begin▁of▁sentence｜>### Instruction:
Given a Python dictionary object, can you use the named_temporary_file context manager to create a named temporary file, write the JSON representation of the dictionary to this file, and then print the name of the temporary file that was created?
### Response:
import json
from tempfile import NamedTemporaryFile

# Using the context manager to create a named temporary file
def write_to_temp_file(data, path=None):
    with NamedTemporaryFile(mode='w', delete=False, dir=path) as tmpfile:
        json.dump(data, tmpfile)
        return tmpfile.name

# Example data to write to the temporary file
data_to_write = {'key': 'value'}

# Writing to the temporary file and getting its name
temp_file_name = write_to_temp_file(data_to_write)

print(f'Temporary file created: {temp_file_name}')
<|EOT|>
