def _learn(self, legislator):
name, obj = legislator, legislator['<STR_LIT>']<EOL>if (legislator['<STR_LIT>'] and legislator['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>'] ==<EOL>self._term and legislator['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT:type>'] == '<STR_LIT>'):<EOL><INDENT>chamber = legislator['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>chamber = legislator['<STR_LIT>'][self._term][<NUM_LIT:0>].get('<STR_LIT>')<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>(legislator['<STR_LIT>'], legislator['<STR_LIT>'],<EOL>self._term))<EOL><DEDENT><DEDENT>if '<STR_LIT>' in name:<EOL><INDENT>code = name['<STR_LIT>']<EOL>if code in self._codes[chamber] or code in self._codes[None]:<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>(code, name['<STR_LIT>']))<EOL><DEDENT>self._codes[chamber][code] = obj<EOL>self._codes[None][code] = obj<EOL><DEDENT>forms = set()<EOL>def add_form(form):<EOL><INDENT>forms.add(self._normalize(form))<EOL><DEDENT>add_form(name['<STR_LIT>'])<EOL>add_form(name['<STR_LIT>'])<EOL>add_form(name['<STR_LIT>'])<EOL>if name['<STR_LIT>']:<EOL><INDENT>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>'][<NUM_LIT:0>]))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'][<NUM_LIT:0>], name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>'][<NUM_LIT:0>]))<EOL>if name['<STR_LIT>']:<EOL><INDENT>add_form("<STR_LIT>" % (name['<STR_LIT>'], name['<STR_LIT>'],<EOL>name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'][<NUM_LIT:0>],<EOL>name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'],<EOL>name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'][<NUM_LIT:0>],<EOL>name['<STR_LIT>'][<NUM_LIT:0>]))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'][<NUM_LIT:0>],<EOL>name['<STR_LIT>']))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'],<EOL>name['<STR_LIT>'][<NUM_LIT:0>]))<EOL>add_form("<STR_LIT>" % (name['<STR_LIT>'],<EOL>name['<STR_LIT>'][<NUM_LIT:0>],<EOL>name['<STR_LIT>'][<NUM_LIT:0>]))<EOL><DEDENT><DEDENT>for form in forms:<EOL><INDENT>form = self._normalize(form)<EOL>if form in self._names[chamber]:<EOL><INDENT>self._names[chamber][form] = None<EOL><DEDENT>else:<EOL><INDENT>self._names[chamber][form] = obj<EOL><DEDENT>if form in self._names[None]:<EOL><INDENT>self._names[None][form] = None<EOL><DEDENT>else:<EOL><INDENT>self._names[None][form] = obj<EOL><DEDENT><DEDENT>
Expects a dictionary with full_name, first_name, last_name and
middle_name elements as key.

While this can grow quickly, we should never be dealing with
more than a few hundred legislators at a time so don't worry about
it.