def _generate_unique_filename_with_timestamp_and_increment(
    timestamp, users_existing_manifest_files
):
    """
    A helper function for _generate_unique_manifest_filename(), which facilitates unit testing.
    Adds an increment to the filename if there happens to be another timestamped file with the same name
    (unlikely, but good to check).
    """
    filename_without_extension = "manifest-" + timestamp.replace(":", "-")
    extension = ".json"

    filename = filename_without_extension + extension
    i = 1
    while filename in users_existing_manifest_files:
        filename = filename_without_extension + extension
        if filename in users_existing_manifest_files:
            filename = filename_without_extension + "-" + str(i) + extension
        i += 1

    return filename