'Assert that a tag in `content` has a certain value in a certain attribute.'

def assert_tag_has_attr(self, content, tag, attname, value):

    regex = '<{tag}    [^>]*\\b{attname}=[\'"]([\\w\\d\\-    ]+)[\'"][^>]*>'.format(tag=tag, attname=attname)
    match = re.search(regex, content)
    self.assertTrue(match, ("Couldn't    find    desired    tag    '%s'    with    attr    '%s'    in    %r" % (tag, attname, content)))
    attvalues = match.group(1).split()
    self.assertIn(value, attvalues)
