from typing import Callable


def num_lines_satisfying(data: str, pred: Callable[[str], bool]) -> int:
    """The number of lines in data which satisfy the predicate pred."""
    return len(list(filter(pred, data.splitlines())))