import itertools


def min_or_none(values, *, key=None):
    """Like min(), but returns None if the input is empty.
    """
    values = iter(values)
    try:
        first_value = next(values)
    except StopIteration:
        return None
    return min(itertools.chain((first_value,), values), key=key)