def prepare_for_sleep(self, start: bool) -> None:
        """
        Handler for "PrepareForSleep" signal.

        Value of "sleep" is:
        - True when the machine is about to sleep
        - False when the event is over i.e. the machine has woken up
        """
        if start:
            hook.fire("suspend")

            # Note: lock is released after the "suspend" hook has been fired
            # Hooked functions should therefore be synchronous to ensure they
            # complete before the inhbitor is released.
            self.release()
        else:
            # If we're listening for suspend events, we need to request a new
            # inhibitor
            if self.sleep:
                self.take()
            hook.fire("resume")

        Handler for "PrepareForSleep" signal.

        Value of "sleep" is:
        - True when the machine is about to sleep
        - False when the event is over i.e. the machine has woken up
        
libqtile/resources/sleep.py