def format_css(style):
    """
    Given a style object from view.style_for_scope, converts the styles into
    a CSS string
    """
    result = ""

    if (style["foreground"]):
        result += "color: {0};".format(style["foreground"])

    if (style["bold"]):
        result += "font-weight: bold;"

    if (style["italic"]):
        result += "font-style: italic;"

    return result