def get_power_status() -> SystemPowerStatus:
    """Retrieves the power status of the system.

    The status indicates whether the system is running on AC or DC power,
    whether the battery is currently charging, how much battery life remains,
    and if battery saver is on or off.

    :raises OSError: if the call to GetSystemPowerStatus fails
    :return: the power status
    :rtype: SystemPowerStatus
    """
    get_system_power_status = ctypes.windll.kernel32.GetSystemPowerStatus
    get_system_power_status.argtypes = [ctypes.POINTER(SystemPowerStatus)]
    get_system_power_status.restype = wintypes.BOOL
    status = SystemPowerStatus()

    if not get_system_power_status(ctypes.pointer(status)):
        raise ctypes.WinError()
    else:
        return status
Retrieves the power status of the system.

    The status indicates whether the system is running on AC or DC power,
    whether the battery is currently charging, how much battery life remains,
    and if battery saver is on or off.

    :raises OSError: if the call to GetSystemPowerStatus fails
    :return: the power status
    :rtype: SystemPowerStatus