def strip_br(s):
if isinstance(s, basestring):<EOL><INDENT>return re.sub(r'<STR_LIT>', '<STR_LIT>', s)<EOL><DEDENT>elif isinstance(s, (tuple, list)):<EOL><INDENT>try:<EOL><INDENT>return type(s)(list(s)[:-<NUM_LIT:1>] + [strip_br(s[-<NUM_LIT:1>])])<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):  <EOL><INDENT>return s<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return type(s)(strip_br(str(s)))<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):  <EOL><INDENT>return s<EOL><DEDENT><DEDENT>
r""" Strip the trailing html linebreak character (<BR />) from a string or sequence of strings

    A sequence of strings is assumed to be a row in a CSV/TSV file or words from a line of text
    so only the last element in a sequence is "stripped"

    >>> strip_br(' Title <BR> ')
    ' Title'
    >>> strip_br(list(range(1, 4)))
    [1, 2, 3]
    >>> strip_br((' Column 1<br />', ' Last Column < br / >  '))
    (' Column 1<br />', ' Last Column')
    >>> strip_br(['name', 'rank', 'serial\nnumber', 'date <BR />'])
    ['name', 'rank', 'serial\nnumber', 'date']
    >>> strip_br(None)
    >>> strip_br([])
    []
    >>> strip_br(())
    ()
    >>> strip_br(('one element<br>',))
    ('one element',)