You error is with python syntax:
Code resolved
for x in geocode[0]['address_components']:
print(x)
if 'administrative_area_level_1' in x['types'] :
print(x['long_name'])
1
solved Reverse geocoding with Python/GoogleMaps API: How to parse response