from datetime import datetime
import pytz


def date_block_key_fn(block):
    """
    If the block's date is None, return the maximum datetime in order
    to force it to the end of the list of displayed blocks.
    """
    return block.date or datetime.max.replace(tzinfo=pytz.UTC)