def type_or_none(default_type):
    """
    Convert the string 'None' to the value `None`.

    >>> f = type_or_none(int)
    >>> f(None) is None
    True
    >>> f('None') is None
    True
    >>> f(123)
    123
    """
    def f(value):
        if value is None or value == 'None':
            return None
        return default_type(value)
    return f