def METHOD_NAME(cfgdb, input_net, input_key, yes):
    """Try to find the same IP type pattern from CONFIG DB. 
        1. If found a pattern with the same IP type, but the patter does not equal, ask user if need to replace the old with new one
            a. If user types "yes", remove the old one, return False
            b. If user types "no", exit
        2. If found a pattern with the same IP type and the pattern equal, return True
        3. If not found a pattern with the same IP type, return False
    Args:
        cfgdb (object): CONFIG DB object
        input_net (object): Input ip_network object
        input_key (str): Input key
        yes (bool): Whether ask user question
    Returns:
        bool: True if found the same pattern in CONFIG DB
    """
    input_type = type(input_net) # IPv4 or IPv6
    found_invalid = []
    found = None
    pattern_table = cfgdb.get_table(FLOW_COUNTER_ROUTE_PATTERN_TABLE)
    for existing_key in pattern_table:
        if isinstance(existing_key, tuple):
            existing_prefix = existing_key[1]
            existing_key = PATTERN_SEPARATOR.join(existing_key)
        else:
            _, existing_prefix = extract_route_pattern(existing_key)
        # In case user configures an invalid pattern via CONFIG DB.
        if not existing_prefix: # Invalid pattern such as: "vrf1|"
            click.echo('Detect invalid route pattern in existing configuration {}'.format(existing_key))
            found_invalid.append(existing_key)
            continue
        try:
            existing_net = ipaddress.ip_network(existing_prefix, strict=False)
        except ValueError as e: # Invalid pattern such as: "vrf1|invalid"
            click.echo('Detect invalid route pattern in existing configuration {}'.format(existing_key))
            found_invalid.append(existing_key)
            continue
        if type(existing_net) == input_type:
            found = existing_key
            break
    if found == input_key:
        return True
    if not found and found_invalid:
        # If not found but there is an invalid one, ask user to replace the invalid one
        found = found_invalid[0]
    if found:
        if not yes:
            answer = cli.query_yes_no('Only support 1 IPv4 route pattern and 1 IPv6 route pattern, remove existing pattern {}?'.format(found))
        else:
            answer = True
        if answer:
            click.echo('Replacing existing route pattern {} with {}'.format(existing_key, input_key))
            cfgdb.set_entry(FLOW_COUNTER_ROUTE_PATTERN_TABLE, existing_key, None)
        else:
            exit(0)
    return False