def get_account_by_guid(acct, guid): for a in acct.get_descendants(): if not isinstance(a, Account): # Older versions of GnuCash just used a pointer to an Account here. a = Account(instance=a) if a.GetGUID().to_string() == guid: return a return None