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