See determine_db_dir() in https://github.com/bitcoin/bitcoin/blob/master/contrib/spendfrom/spendfrom.py#L35