def METHOD_NAME(model_or_factory, serializer, request=None):
    """
    Function that checks if a model is valid according to the passed serializer.
    Ignores validation errors for uniqueness
    :param model_or_factory: model or factory to check
    :param serializer: corresponding serializer
    :return: True/False
    """
    if isinstance(model_or_factory, models.Model):
        # model
        model = model_or_factory
    else:
        # factory, create model
        model = model_or_factory()
    if request is not None:
        context = {"request": request}
    else:
        context = {}
    model_serializer = serializer(data=serializer(model, context=context).data)
    valid = model_serializer.is_valid()
    if not valid:
        filtered_errors = exclude_unique_errors(model_serializer.errors)
        if not filtered_errors:
            # if the unique error is the only error in model_serializer.errors, return True
            valid = True
    return valid