def add_version(self, name, url, mimetype=None, on_duplicate='<STR_LIT:error>',<EOL>**kwargs):
if not mimetype:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if on_duplicate != '<STR_LIT:ignore>':<EOL><INDENT>if url in self._seen_versions:<EOL><INDENT>if on_duplicate == '<STR_LIT:error>':<EOL><INDENT>raise ValueError('<STR_LIT>' % url)<EOL><DEDENT>elif on_duplicate == '<STR_LIT>':<EOL><INDENT>self['<STR_LIT>'] = [v for v in self['<STR_LIT>']<EOL>if v['<STR_LIT:url>'] != url]<EOL><DEDENT>elif on_duplicate == '<STR_LIT>':<EOL><INDENT>return       <EOL><DEDENT><DEDENT>self._seen_versions.add(url)<EOL><DEDENT>d = dict(name=name, url=url, mimetype=mimetype, **kwargs)<EOL>self['<STR_LIT>'].append(d)<EOL>
Add a version of the text of this bill.

:param name: a name given to this version of the text, e.g.
             'As Introduced', 'Version 2', 'As amended', 'Enrolled'
:param url: the location of this version on the legislative website.
:param mimetype: MIME type of the document
:param on_duplicate: What to do if a duplicate is seen:
    error - default option, raises a ValueError
    ignore - add the document twice (rarely the right choice)
    use_new - use the new name, removing the old document
    use_old - use the old name, not adding the new document

If multiple formats are provided, a good rule of thumb is to
prefer text, followed by html, followed by pdf/word/etc.