for race in soup.find_all('race'):
    raceid = race['id']
for nomination in race.find_all('nomination', recursive=False):
    nomination['raceid'] = raceid
PyQuery How do I append and rename an element into each of its subelements