code: def _extract_battery_info_from_acpi(self):
          
  
          def _parse_battery_info(acpi_battery_lines):
              battery = {}
              battery["percent_charged"] = int(
                  findall("(?<= )(\d+)(?=%)", acpi_battery_lines[0])[0]
              )
              battery["charging"] = "Charging" in acpi_battery_lines[0]
              battery["capacity"] = int(
                  findall("(?<= )(\d+)(?= mAh)", acpi_battery_lines[1])[1]
              )
  
              # ACPI only shows time remaining if battery is discharging or
              # charging
              try:
                  battery["time_remaining"] = "".join(
                      findall(
                          "(?<=, )(\d+:\d+:\d+)(?= remaining)|"
                          "(?<=, )(\d+:\d+:\d+)(?= until)",
                          acpi_battery_lines[0],
                      )[0]
                  )
              except IndexError:
                  battery["time_remaining"] = FULLY_CHARGED
  
              return battery
  
          acpi_list = self.py3.command_output(["acpi", "-b", "-i"]).splitlines()
  
          # Separate the output because each pair of lines corresponds to a
          # single battery.  Now the list index will correspond to the index of
          # the battery we want to look at
          acpi_list = [acpi_list[i : i + 2] for i in range(0, len(acpi_list) - 1, 2)]
  
          return [_parse_battery_info(battery) for battery in acpi_list]
docs: Get the battery info from acpi
  
          # Example acpi -bi raw output (Discharging):
          Battery 0: Discharging, 94%, 09:23:28 remaining
          Battery 0: design capacity 5703 mAh, last full capacity 5283 mAh = 92%
          Battery 1: Unknown, 98%
          Battery 1: design capacity 1880 mAh, last full capacity 1370 mAh = 72%
  
          # Example Charging
          Battery 0: Charging, 96%, 00:20:40 until charged
          Battery 0: design capacity 5566 mAh, last full capacity 5156 mAh = 92%
          Battery 1: Unknown, 98%
          Battery 1: design capacity 1879 mAh, last full capacity 1370 mAh = 72%