human
Complete this python program:
def caps(text):
assistant
#Here is the Python program you requested.

    """Wraps multiple capital letters in ``<span class="caps">``
    so they can be styled with CSS.
    >>> caps("A message from KU")
    u\A message from <span class="caps">KU</span>\
    Uses the smartypants tokenizer to not screw with HTML or with tags it shouldn\t.
    >>> caps("<PRE>CAPS</pre> more CAPS")
    u\<PRE>CAPS</pre> more <span class="caps">CAPS</span>\
    >>> caps("A message from 2KU2 with digits")
    u\A message from <span class="caps">2KU2</span> with digits\
    >>> caps("Dotted caps followed by spaces should never include them in the wrap D.O.T.   like so.")
    u\Dotted caps followed by spaces should never include them in the wrap <span class="caps">D.O.T.</span>  like so.\
    All caps with with apostrophes in them shouldn\t break. Only handles dump apostrophes though.
    >>> caps("JIMMY\S")
    u\<span class="caps">JIMMY\\S</span>\
    >>> caps("<i>D.O.T.</i>HE34T<b>RFID</b>")
    u\<i><span class="caps">D.O.T.</span></i><span class="caps">HE34T</span><b><span class="caps">RFID</span></b>\
    """
    text = force_unicode(text)
    tokens = _smartypants._tokenize(text)
    result = []
    in_skipped_tag = False
    cap_finder = re.compile("(\n                                                                                                                (\\b[A-Z\\d]*                                #    Group    2:    Any    amount    of    caps    and    digits\n                                                                                                                [A-Z]\\d*[A-Z]                        #    A    cap    string    much    at    least    include    two    caps    (but    they    can    have    digits    between    them)\n                                                                                                                [A-Z\\d']*\\b)                            #    Any    amount    of    caps    and    digits    or    dumb    apostsrophes\n                                                                                                                |    (\\b[A-Z]+\\.\\s?            #    OR:    Group    3:    Some    caps,    followed    by    a    '.'    and    an    optional    space\n                                                                                                                (?:[A-Z]+\\.\\s?)+)        #    Followed    by    the    same    thing    at    least    once    more\n                                                                                                                (?:\\s|\\b|$))\n                                                                                                                ", re.VERBOSE)
    def _cap_wrapper(matchobj):
        'This    is    necessary    to    keep    dotted    cap    strings    to    pick    up    extra    spaces'
        if matchobj.group(2):
            return ('<span    class="caps">%s</span>' % matchobj.group(2))
        else:
            if (matchobj.group(3)[(-1)] == '    '):
                caps = matchobj.group(3)[:(-1)]
                tail = '    '
            else:
               ...