First draft for handle_check_local
However, might be completely wrong, and misses a lot of cases since only the
trivial one are given.