def default(default_value, force=False):
    """
    Creates a function which allows a field to fallback to a given default
    value.

    :param Any default_value: The default value to set
    :param bool force: Whether or not to force the default value regardless of a
                       value already being present
    :rtype: function
    """
    def default_setter(value):
        """
        Sets the value to the given default value, assuming the original value
        is not set or the default value is set to forced.

        :param Any value: Injected by CKAN core
        :rtype: Any
        """
        return value if value and not force else default_value

    return default_setter