def public_export(self): result = {} for name, attr in asdict(self, recurse=False).items(): if isinstance(attr, Keypair): result[name + '_pk'] = pet2ascii(attr.pk) return result