def alt_text_to_curly_bracket(text):
    """
    Converts the text that appears in the alt attribute of image tags from gatherer
    to a curly-bracket mana notation.
    ex: 'Green'->{G}, 'Blue or Red'->{U/R}
        'Variable Colorless' -> {XC}
        'Colorless' -> {C}
        'N colorless' -> {N}, where N is some number
    """
    def convert_color_to_letter(color):
        if color.lower() not in ('red', 'white', 'blue', 'green', 'black', 'colorless', 'tap', 'energy'):
            # some cards have weird split mana costs where you can pay N colorless
            # or one of a specific color.
            # Since we're ending up here, and what we're given isn't a color, lets assume its N
            return color
        else:
            if color.lower() == 'blue': return 'U'
            else: return color[0].upper()

    try:
        val = int(text, 10)
    except Exception:
        pass
    else:
        # This is just a number. Easy enough.
        return f"{{{text}}}"

    if ' or ' in text:
        # this is a compound color, not as easy to deal with.
        text = text.replace('or', '')
        text = '/'.join([convert_color_to_letter(x) for x in text.split()])

    else:
        if 'Variable' in text:
            text = 'X'
        else:
            # hopefully all that's left is just simple color symbols.
            text = convert_color_to_letter(text)

    # at this point we've hopefully
    return f"{{{text}}}"