def _calculate_remaining_battery_percentage(self, voltage):
        """Calculate percentage."""
        min_voltage = 2500
        max_voltage = 3000
        percent = (voltage - min_voltage) / (max_voltage - min_voltage) * 200
        return min(200, percent)
def _calculate_remaining_battery_percentage ( self , voltage ) : min_voltage = 2500 max_voltage = 3000 percent = ( voltage - min_voltage ) / ( max_voltage - min_voltage ) * 200 return min ( 200 , percent )
Calculate percentage.