Python Fit Function To Count Characters