def init_default(required, default, optional_default):
    """
    Returns optional default if field is not required and
    default was not provided.

    :param bool required: whether the field is required in a given model.
    :param default: default provided by creator of field.
    :param optional_default: default for the data type if none provided.
    :return: default or optional default based on inputs
    """
    if not required and default == NOTHING:
        default = optional_default

    return default
Returns optional default if field is not required and
    default was not provided.

    :param bool required: whether the field is required in a given model.
    :param default: default provided by creator of field.
    :param optional_default: default for the data type if none provided.
    :return: default or optional default based on inputs