human
Write me a Python function for renaming a key in a dictionary.
assistant
Here is a Python function for renaming a key in a dictionary

import copy

def rename_key(dictionary, old_key, new_key):
    """Renames a key in a dictionary.

    :param dictionary: The dictionary to be renamed
    :param old_key: The old key to be renamed
    :param new_key: The new key to be renamed
    """
    dictionary[new_key] = dictionary.pop(old_key)

# Enter the dictionary
dictionary = {"key1": "value1", "key2": "value2"}

# Enter the old key
old_key = "key1"

# Enter the new key
new_key = "key2"

# Calling the function
print((rename_key(dictionary, old_key, new_key)))

#Example Output
# None

#Remember to inspect code for bugs.