def auto_cleaned_path(instance, filename: str) -> str:
    """
    Gets upload path in this format: {MODEL_NAME}/{SAFE_UPLOADED_FILENAME}{SUFFIX}.

    :param instance: Instance of model or model class.
    :param filename: Uploaded file name.
    :return: Target upload path.
    """
    stem, suffix = parse_filename(filename)
    base_dir = get_base_dir_from_object(instance)
    target_filename = get_safe_path_name(stem)

    return os.path.join(base_dir, "{target_filename}{suffix}".format(target_filename=target_filename,
                                                                     suffix=suffix))
Gets upload path in this format: {MODEL_NAME}/{SAFE_UPLOADED_FILENAME}{SUFFIX}.

    :param instance: Instance of model or model class.
    :param filename: Uploaded file name.
    :return: Target upload path.