import re


def add_css(str):
    """ Add css span tags to text by replacing strings of form:
      ":red:`some text`"  with  "<span class=\"red\">some text</span>"
    """
    css_str = re.sub(r':(\w+):`([^`]+)`', r'<span class="\1">\2</span>', str)
    return css_str