Suppose if you have an battery charged to 3.7 V and this battery have Rint = 1 ohm. trying to charge with 500 mA will fail because voltage drop on internal resistance will be 0.5V and across batt conections will be 4.2 V and charger will say "enough"
The script is not finished! I can't find any info about r_sense resistor influence for bq27200 voltage readings.