def METHOD_NAME(initial, to_remove):
    client = get_client()
    client.modify_document_permission(
        Name="TestDocument", PermissionType="Share", AccountIdsToAdd=initial
    )
    client.modify_document_permission(
        Name="TestDocument", PermissionType="Share", AccountIdsToRemove=to_remove
    )
    res = client.describe_document_permission(
        Name="TestDocument", PermissionType="Share"
    )
    assert "AccountIds" in res
    expected_new_list = {x for x in initial if x not in to_remove}
    assert set(res["AccountIds"]) == expected_new_list
    expected_account_sharing = [
        {"AccountId": _id, "SharedDocumentVersion": "$DEFAULT"}
        for _id in expected_new_list
    ]
    assert res["AccountSharingInfoList"] == expected_account_sharing