def matches_token(token: str, pc: int):
    """
    Whether a percentage value matches a token, which are the elements
    of the search patterns.

    e.g. for the pattern "80+ 95+", the pc value "82" matches the token
    "80+", but would not match the token "95+".
    """
    if not token:
        raise ValueError("need a token")

    or_more = token[-1] == "+"
    or_less = token[-1] == "-"

    val_token = int(token[:-1]) if or_more or or_less else int(token)

    if or_more:
        return pc >= val_token
    elif or_less:
        return pc <= val_token
    else:
        return pc == val_token