human
Give me a Python function to return an inverted dictionary.
assistant
Here is a Python function to return an inverted dictionary

import re

def invert_dict(d):
    """
    Return inverted dictionary.
    """
    return {v: k for k, v in list(d.items())}

# Enter the dictionary
d = {"cat": "dog", "dog": "cat"}

# Calling the function
print((invert_dict(d)))

#Example Output
# {'dog': 'cat', 'cat': 'dog'}

#Remember to inspect code for bugs.