I am new to coding and I am looking to code a function (max_dict) that takes two dictionaries and creates a third dictionary that includes only keys and values where the key was contained in both dictionaries. The code below works, but I want a more efficient way to do it! Thanks!
def max_dict(dict1, dict2):
    new_dict = {}
    for key, value in dict1.items():
        for k, v in dict2.items():
            if key == k:
                new_dict[key] = value
    return new_dict