from datetime import datetime
from typing import Callable


def is_before(time: datetime, now: Callable[[], datetime]=datetime.now) -> Callable[[], bool]:
    """
    :param time: A time
    :param now: A function to use to get the current time (defaults to datetime.now)
    :return: A predicate that checks if the current time is before the given time
    """
    def predicate() -> bool:
        """
        :return: Whether the current time is before the given time
        """
        return now() < time
    predicate.__name__ = f'_{is_before.__name__}_{datetime}'
    return predicate