My two cents is if you re-range them then you mess with the statistics.
You need to account for hands that could be a buff.
I would be more likely to add cards than take them away. Early positions comes in for a raise on 468 rainbow and leads on the flop and you had no 5 or 7 in their range then you need to consider that. But I would not take out AK sited or any pair.
If you over react to their actions you become exploitable and leave a more clear signature as a bot.
I would look at it more as Esfandiari says does it make sense. Did not bet the flop or turn but bet the river. If you take a way the busted hands that would do that in desperation I think you have a hole the size of Dallas in the algorithm.
Ranging is statistics but at some point you need to go with a GTO or machine learning type decision tree.
Hey that flush draw was only 20% but the way the hand was played is credible.
A bot to play against a low end player is so much different than a mid or high end.
Fool Pokerstars and Partypoker is another thing. The have some real smart people looking for patterns. And you have posted Open Source.