def METHOD_NAME(request, resource_id):
    response = get_tus_response()
    filename = cache.get("tus-uploads/{}/filename".format(resource_id))
    metadata = cache.get("tus-uploads/{}/metadata".format(resource_id))
    offset = cache.get("tus-uploads/{}/offset".format(resource_id))
    file_offset = int(request.META.get("HTTP_UPLOAD_OFFSET", 0))
    chunk_size = int(request.META.get("CONTENT_LENGTH", 102400))
    upload_file_path = to_path(safe_join(get_upload_path(), resource_id))
    if filename is None or not upload_file_path.exists():
        response.status_code = 410
        return response
    if file_offset != offset:  # check to make sure we're in sync
        response.status_code = 409  # HTTP 409 Conflict
        return response
    logger.info(
        f"TUS patch resource_id={resource_id} filename={filename} metadata={metadata} offset={offset} upload_file_path={upload_file_path}"
    )
    try:
        file = upload_file_path.open("r+b")
    except IOError:
        file = upload_file_path.open("wb")
    if file:
        try:
            file.seek(file_offset)
            file.write(request.body)
        except IOError:
            response.status_code = 500
            return response
        finally:
            file.close()
    try:
        new_offset = cache.incr("tus-uploads/{}/offset".format(resource_id), chunk_size)
    except ValueError:
        response.status_code = 404
        return response
    file_size_string = cache.get("tus-uploads/{}/file_size".format(resource_id))
    if file_size_string is None:
        response.status_code = 404
        return response
    response["Upload-Offset"] = new_offset
    response.status_code = 204
    file_size = int(file_size_string)
    if file_size == new_offset:
        remove_resource_from_cache(resource_id)
        create_uploaded_file_in_db(
            field_name=metadata.get("fieldName"),
            file_id=resource_id,
            form_id=metadata.get("formId"),
            original_filename=metadata.get("filename"),
            uploaded_file=upload_file_path,
        )
    return response