Make _get_last_key a static method