for item in soup3.find_all('XMLTag'):
    r = {}
for i, tag in enumerate(tags, 1):
    value = getattr(item, tag).string
if value is not None:
    r['definition' + str(i)] = value
Removing NoneTypes from a dictionary