def wrap_filter(hook, filter_fn):
    """
    takes in a hook and only applies it when the given filter function
    returns a truthy value
    """
    def wrap_filter_inner(hs):
        if filter_fn(hs):
            return hook(hs)
        else:
            return hs()

    return wrap_filter_inner