Add _getrealpath and doctest