def _get_home():
path='<STR_LIT>'<EOL>try:<EOL><INDENT>path=os.path.expanduser("<STR_LIT>")<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>if not os.path.isdir(path):<EOL><INDENT>for evar in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>path = os.environ[evar]<EOL>if os.path.isdir(path):<EOL><INDENT>break<EOL><DEDENT><DEDENT>except: pass<EOL><DEDENT><DEDENT>if path:<EOL><INDENT>return path<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>
Find user's home directory if possible.
    Otherwise raise error.

    :see:  http://mail.python.org/pipermail/python-list/2005-February/263921.html