key = '5'
state = {'1': 'a', '2':'b', '3':'c', '4':'v', '5':'b', '6':'n', '7':'m'}
# Нужно получить следующий словарь
new_state = {'5':'b', '6':'n', '7':'m'}
new_state = {}
flag = False
for k, v in state.items():
if key == k:
flag = True
if flag:
new_state[k] = v
from itertools import dropwhile
key = '5'
state = {1: 'a', 'abc': 'b', 3.14:'c', None: 'v', '5': 'b', '6': 'n', '7': 'm'}
new_state = dict(dropwhile(lambda item: item[0] != key, state.items()))
for k in state.copy():
if k != key:
del state[k]
else:
break