def dumps(self):
def _is_initial(author_name):<EOL><INDENT>return len(author_name) == <NUM_LIT:1> or u'<STR_LIT:.>' in author_name<EOL><DEDENT>def _ensure_dotted_initials(author_name):<EOL><INDENT>if _is_initial(author_name)and u'<STR_LIT:.>' not in author_name:<EOL><INDENT>seq = (author_name, u'<STR_LIT:.>')<EOL>author_name = u'<STR_LIT>'.join(seq)<EOL><DEDENT>return author_name<EOL><DEDENT>def _ensure_dotted_suffixes(author_suffix):<EOL><INDENT>if u'<STR_LIT:.>' not in author_suffix:<EOL><INDENT>seq = (author_suffix, u'<STR_LIT:.>')<EOL>author_suffix = u'<STR_LIT>'.join(seq)<EOL><DEDENT>return author_suffix<EOL><DEDENT>def _is_roman_numeral(suffix):<EOL><INDENT>"""<STR_LIT>"""<EOL>valid_roman_numerals = [u'<STR_LIT:M>', u'<STR_LIT:D>', u'<STR_LIT:C>', u'<STR_LIT:L>', u'<STR_LIT:X>',<EOL>u'<STR_LIT>', u'<STR_LIT:I>', u'<STR_LIT:(>', u'<STR_LIT:)>']<EOL>return all(letters in valid_roman_numerals<EOL>for letters in suffix.upper())<EOL><DEDENT>first_and_middle_names = iter(_ensure_dotted_initials(name) for name in self.first_list)<EOL>try:<EOL><INDENT>prev = next(first_and_middle_names)<EOL><DEDENT>except StopIteration:<EOL><INDENT>LOGGER.warning(u"<STR_LIT>",<EOL>self._parsed_name.original)<EOL>prev = self._parsed_name.original<EOL><DEDENT>names_with_spaces = [prev]<EOL>for name in first_and_middle_names:<EOL><INDENT>if not _is_initial(name) or not _is_initial(prev):<EOL><INDENT>names_with_spaces.append('<STR_LIT:U+0020>')<EOL><DEDENT>prev = name<EOL>names_with_spaces.append(prev)<EOL><DEDENT>normalized_names = u'<STR_LIT>'.join(names_with_spaces)<EOL>if _is_roman_numeral(self.suffix):<EOL><INDENT>suffix = self.suffix.upper()<EOL><DEDENT>else:<EOL><INDENT>suffix = _ensure_dotted_suffixes(self.suffix)<EOL><DEDENT>final_name = u'<STR_LIT:U+002CU+0020>'.join(<EOL>part for part in (self.last, normalized_names.strip(), suffix)<EOL>if part)<EOL>final_name = final_name.replace(u'<STR_LIT>', '<STR_LIT>')<EOL>return final_name<EOL>
Dump the name to string, after normalizing it.