def PrintPortfolio(pfl, with_returns=False):
 print 'Portfolio Title   :', pfl.portfolio_title
 print 'Portfolio ID      :', pfl.portfolio_id
 print '  Last updated    :', pfl.updated.text
 d = pfl.portfolio_data
 print '  Currency        :', d.currency_code
 if with_returns:
  print '  Gain %          :', d.gain_percentage
  PrRtn('  Returns         :', d)
  print '  Cost basis      :', d.cost_basis
  print '  Days gain       :', d.days_gain
  print '  Gain            :', d.gain
  print '  Market value    :', d.market_value
 print
 if pfl.positions:
  print '  <inlined positions>\n'
  PrintPositions(pfl.positions, with_returns)
  print '  </inlined positions>\n'

def PrintPortfolio ( pfl , with_returns = False ) : print 'Portfolio Title   :' , pfl . portfolio_title print 'Portfolio ID      :' , pfl . portfolio_id print '  Last updated    :' , pfl . updated . text d = pfl . portfolio_data print '  Currency        :' , d . currency_code if with_returns : print '  Gain %          :' , d . gain_percentage PrRtn ( '  Returns         :' , d ) print '  Cost basis      :' , d . cost_basis print '  Days gain       :' , d . days_gain print '  Gain            :' , d . gain print '  Market value    :' , d . market_value print if pfl . positions : print '  <inlined positions>\n' PrintPositions ( pfl . positions , with_returns ) print '  </inlined positions>\n'
print single portfolio .