The code seems a bit long for something that trivial.
Is there a pythonic way to shorten it?
fruit = None
for _fruit in basket:
if _fruit['name'] != 'banana':
continue
fruit = _fruit
fruit = None
for _fruit in basket:
if _fruit['name'] == 'banana':
fruit = _fruit