def METHOD_NAME(
    filepaths, title, author=None, use_sandbox=False, record_name=None
):
    filepaths = [pathlib.Path(filepath) for filepath in filepaths]
    root_depositions_url = get_root_depositions_url(use_sandbox)
    if record_name is not None:
        if use_sandbox:
            raise ValueError("Cannot use sandbox when `record_name` is provided")
        old_deposition_id = get_zenodo_record_id(record_name)
        old_deposition_url = f"{root_depositions_url}/{old_deposition_id}"
        new_version_url = f"{old_deposition_url}/actions/newversion"
        r = zenodo_api_with_helpful_fallback(new_version_url, "post")
        deposition_id = int(r.json()["links"]["latest_draft"].split("/")[-1])
    else:
        r = zenodo_api_with_helpful_fallback(
            root_depositions_url, "post", json={}, headers=HEADERS
        )
        try:
            response = r.json()
        except json.JSONDecodeError:
            raise ValueError(f"Unexpected response: {r.text}")
        try:
            deposition_id = response["id"]
        except KeyError:
            raise ValueError(f"Unexpected response: {response}")
    metadata = create_metadata(title, author)
    set_metadata(metadata, deposition_id, use_sandbox=use_sandbox)
    filenames = [path.name for path in filepaths]
    delete_filenames_within_record(filenames, deposition_id, use_sandbox=use_sandbox)
    upload_filepaths(filepaths, deposition_id, use_sandbox=use_sandbox)
    publish_deposition(deposition_id, use_sandbox=use_sandbox)
    return deposition_id