I have a list
list_x = ['8', '4', '5', '6', '1']
and a dictionary
dict_1 = {'0': {'ID=3': 1, 'ID=7': 1},
'1': {'ID=7': 2, 'ID=6': 2},
'2': {'ID=7': 3, 'ID=5': 1},
'3': {'ID=7': 2, 'ID=1': 1},
'4': {'ID=3': 3, 'ID=5': 1, 'ID=4': 1},
'5': {'ID=5': 1, 'ID=2': 3, 'ID=4': 2, 'ID=7': 1, 'ID=8': 1},
'6': {'ID=0': 5, 'ID=3': 7, 'ID=1': 1},
'7': {'ID=1': 1, 'ID=8': 1, 'ID=7': 1},
'8': {'ID=6': 2, 'ID=0': 2, 'ID=2': 2}}
and I want to create a new dictionary dict_2 in which all items of dict_1 are stored that have a key that exists in list_x. How can I do that? I had trouble doing it with two nested for loops since I could access the keys but I could not copy the entire item.