def preconvert_preinstanced_type(value, name, type_):
    """
    Converts the given `value` to an acceptable value by the wrapper.
    
    Parameters
    ----------
    value : `Any`
        The value to convert.
    name : `str`
        The name of the value.
    type_ : ``PreinstancedBase`` instance
        The preinstanced type.
    
    Returns
    -------
    value : ``PreinstancedBase`` instance
    
    Raises
    ------
    TypeError
        If `value` was not given as `type_` instance, neither as `type_.value`'s type's instance.
    ValueError
        If there is no preinstanced object for the given `value`.
    """
    value_type = value.__class__
    if (value_type is not type_):
        value_expected_type = type_.VALUE_TYPE
        if value_type is value_expected_type:
            pass
        elif issubclass(value_type, value_expected_type):
            value = value_expected_type(value)
        else:
            raise TypeError(f'`{name}` can be passed as {type_.__name__} or as {value_expected_type.__name__} '
                f'instance, got {value_type.__name__}.')
        
        try:
            value = type_.INSTANCES[value]
        except LookupError:
            raise ValueError(f'There is no predefined `{name}` for the following value: {value!r}.') from None
    
    return value