def activate_legislators(current_term, abbr):
for legislator in db.legislators.find(<EOL>{'<STR_LIT>': {'<STR_LIT>':<EOL>{settings.LEVEL_FIELD: abbr, '<STR_LIT>': current_term}}}):<EOL><INDENT>active_role = legislator['<STR_LIT>'][<NUM_LIT:0>]<EOL>if not active_role.get('<STR_LIT>') and active_role['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>legislator['<STR_LIT>'] = True<EOL>legislator['<STR_LIT>'] = active_role.get('<STR_LIT>', None)<EOL>legislator['<STR_LIT>'] = active_role.get('<STR_LIT>', None)<EOL>legislator['<STR_LIT>'] = active_role.get('<STR_LIT>', None)<EOL><DEDENT>legislator['<STR_LIT>'] = datetime.datetime.utcnow()<EOL>db.legislators.save(legislator, safe=True)<EOL><DEDENT>
Sets the 'active' flag on legislators and populates top-level
district/chamber/party fields for currently serving legislators.