def convert_binding(binding: str):
    """
    Converts the binding to a key number that can be used with curses
    :param binding: The key binding in a single char string
    :return: An integer containing the key number. If the binding is invalid, returns -1
    """
    special_keys = {
        "TAB": 9,
        "ENTER": 10,
        "UP": 259,
        "DOWN": 258,
        "LEFT": 260,
        "RIGHT": 261
    }

    # If the binding is a special key,
    # convert it with the dictionary of special keys
    if binding in special_keys.keys():
        return special_keys.get(binding)

    # If the binding is only one character long,
    # convert the binding with the ord method
    if len(binding) == 1:
        return ord(binding)

    # If the binding is invalid,
    # return -1
    return -1