def DisplayAccountTree(account, accounts, links, depth=0):
 prefix = (('-' * depth) * 2)
 print ('%s%s, %s' % (prefix, account['customerId'], account['name']))
 if (account['customerId'] in links):
  for child_link in links[account['customerId']]:
   child_account = accounts[child_link['clientCustomerId']]
   DisplayAccountTree(child_account, accounts, links, (depth + 1))

def DisplayAccountTree ( account , accounts , links , depth = 0 ) : prefix = ( ( '-' * depth ) * 2 ) print ( '%s%s, %s' % ( prefix , account [ 'customerId' ] , account [ 'name' ] ) ) if ( account [ 'customerId' ] in links ) : for child_link in links [ account [ 'customerId' ] ] : child_account = accounts [ child_link [ 'clientCustomerId' ] ] DisplayAccountTree ( child_account , accounts , links , ( depth + 1 ) )
displays an account tree .