tools.py: added count_natural() function and its tests