def new_symbol(grammar, symbol_name='<symbol>'):
    """Return a new symbol for `grammar` based on `symbol_name`"""
    if symbol_name not in grammar:
        return symbol_name
    count = 1
    while True:
        tentative_symbol_name = symbol_name[:-1] + '-' + repr(count) + '>'
        if tentative_symbol_name not in grammar:
            return tentative_symbol_name
        count += 1
