async def init():
    me = input('Who are you? ').strip()
    wallet_name = '%s-wallet' % me

    # 1. Create Wallet and Get Wallet Handle
    try:
        await wallet.create_wallet(pool_name, wallet_name, None, None, None)
    except:
        pass
    wallet_handle = await wallet.open_wallet(wallet_name, None, None)
    print('wallet = %s' % wallet_handle)

    (my_did, my_vk) = await did.create_and_store_my_did(wallet_handle, "{}")
    print('my_did and verkey = %s %s' % (my_did, my_vk))

    their = input("Other party's DID and verkey? ").strip().split(' ')
    return wallet_handle, my_did, my_vk, their[0], their[1]

import asyncio
import time
import re

async def prep(wallet_handle, my_vk, their_vk, msg):
    print('prepping %s' % msg)

async def init():
    return None, None, None, None, None

async def read(wallet_handle, my_vk):
    print('reading')

async def demo():
    wallet_handle, my_did, my_vk, their_did, their_vk = await init()

    while True:
        argv = input('> ').strip().split(' ')
        cmd = argv[0].lower()
        rest = ' '.join(argv[1:])
        if re.match(cmd, 'prep'):
            await prep(wallet_handle, my_vk, their_vk, rest)
        elif re.match(cmd, 'read'):
            await read(wallet_handle, my_vk)
        elif re.match(cmd, 'quit'):
            break
        else:
            print('Huh?')

if __name__ == '__main__':
    try:
        loop = asyncio.get_event_loop()
        loop.run_until_complete(demo())
        time.sleep(1)  # waiting for libindy thread complete
    except KeyboardInterrupt:
        print('')

Fix template that was accidentally overwritten
Fix template that was accidentally overwritten

+ import asyncio
+ import time
+ import re
+ 
+ async def prep(wallet_handle, my_vk, their_vk, msg):
+     print('prepping %s' % msg)
+ 
  async def init():
+     return None, None, None, None, None
-     me = input('Who are you? ').strip()
-     wallet_name = '%s-wallet' % me
  
-     # 1. Create Wallet and Get Wallet Handle
+ async def read(wallet_handle, my_vk):
+     print('reading')
+ 
+ async def demo():
+     wallet_handle, my_did, my_vk, their_did, their_vk = await init()
+ 
+     while True:
+         argv = input('> ').strip().split(' ')
+         cmd = argv[0].lower()
+         rest = ' '.join(argv[1:])
+         if re.match(cmd, 'prep'):
+             await prep(wallet_handle, my_vk, their_vk, rest)
+         elif re.match(cmd, 'read'):
+             await read(wallet_handle, my_vk)
+         elif re.match(cmd, 'quit'):
+             break
+         else:
+             print('Huh?')
+ 
+ if __name__ == '__main__':
      try:
-         await wallet.create_wallet(pool_name, wallet_name, None, None, None)
-     except:
-         pass
-     wallet_handle = await wallet.open_wallet(wallet_name, None, None)
-     print('wallet = %s' % wallet_handle)
+         loop = asyncio.get_event_loop()
+         loop.run_until_complete(demo())
+         time.sleep(1)  # waiting for libindy thread complete
+     except KeyboardInterrupt:
+         print('')
  
-     (my_did, my_vk) = await did.create_and_store_my_did(wallet_handle, "{}")
-     print('my_did and verkey = %s %s' % (my_did, my_vk))
- 
-     their = input("Other party's DID and verkey? ").strip().split(' ')
-     return wallet_handle, my_did, my_vk, their[0], their[1]
- 
Fix template that was accidentally overwritten
## Code Before:
async def init():
    me = input('Who are you? ').strip()
    wallet_name = '%s-wallet' % me

    # 1. Create Wallet and Get Wallet Handle
    try:
        await wallet.create_wallet(pool_name, wallet_name, None, None, None)
    except:
        pass
    wallet_handle = await wallet.open_wallet(wallet_name, None, None)
    print('wallet = %s' % wallet_handle)

    (my_did, my_vk) = await did.create_and_store_my_did(wallet_handle, "{}")
    print('my_did and verkey = %s %s' % (my_did, my_vk))

    their = input("Other party's DID and verkey? ").strip().split(' ')
    return wallet_handle, my_did, my_vk, their[0], their[1]

## Instruction:
Fix template that was accidentally overwritten
## Code After:
import asyncio
import time
import re

async def prep(wallet_handle, my_vk, their_vk, msg):
    print('prepping %s' % msg)

async def init():
    return None, None, None, None, None

async def read(wallet_handle, my_vk):
    print('reading')

async def demo():
    wallet_handle, my_did, my_vk, their_did, their_vk = await init()

    while True:
        argv = input('> ').strip().split(' ')
        cmd = argv[0].lower()
        rest = ' '.join(argv[1:])
        if re.match(cmd, 'prep'):
            await prep(wallet_handle, my_vk, their_vk, rest)
        elif re.match(cmd, 'read'):
            await read(wallet_handle, my_vk)
        elif re.match(cmd, 'quit'):
            break
        else:
            print('Huh?')

if __name__ == '__main__':
    try:
        loop = asyncio.get_event_loop()
        loop.run_until_complete(demo())
        time.sleep(1)  # waiting for libindy thread complete
    except KeyboardInterrupt:
        print('')
