def getBatteryStats():
 try:
  from plyer import battery
  return battery.status
 except Exception as e:
  return None

def getBatteryStats ( ) : try : from plyer import battery return battery . status except Exception as e : return None
returns none if an error returns {percentage: 99 .