from typing import Callable
from typing import Any


def fs_pressed(action: Callable[[], None]) -> Callable[[bool], Any]:
    """Returns a handler that calls 'action' only when the button is pressed.
    """
    def handler(pressed: bool):
        if pressed:
            action()
    return handler