@register.simple_tag 
def render_eyebrow_ad():
    """
    Renders a BannerAd instance of the desired size, 'eyebrow'. Defaults to None if
    no such ad exists for a given site.
    """
    site = Site.objects.get_current()

    try:
        ads = BannerAd.current.filter(site=site).filter(ad_type='eyebrow')
#        .filter(special_section__isnull=True) Not sure if we need this anymore. Comment back in otherwise.
        if not ads:
            ad = None
        else:
            ad = random.choice(ads)
    except BannerAd.DoesNotExist:
        ad = None
    if not ad:
        return ''
        
    code = ''
    if not ad.code:
        code = '<img src="%s" alt="%s" />' % (ad.image.url, ad.name)
        if ad.url:
            code = ''.join([ad.url % '<a href="%s">', code, '</a>'])
    else:
        code = ad.code
    code = ''.join(['<div class="ad ad_eyebrow">', code, '</div>'])
            
    return code
dataset/ETHPy150Open albatrossandco/brubeck_cms/brubeck/advertising/templatetags/advertising.py/render_eyebrow_ad/swapped operands of `%`