from datetime import datetime


def get_fake_datetime(now: datetime):
    """Generate monkey patch class for `datetime.datetime`, whose now() and utcnow() always returns given value."""

    class FakeDatetime:
        """Fake datetime.datetime class."""

        @classmethod
        def now(cls):
            """Return given value."""
            return now

        @classmethod
        def utcnow(cls):
            """Return given value."""
            return now

    return FakeDatetime