def kwargify(f): """Convert function having only positional args to a function taking dictionary. If you pass False or None, a function which always returns False is returned. If you pass True, a function which always returns True is returned. """ if f is None or f is False: f = lambda: False elif f is True: f = lambda: True return _kwargify(f)