code: def save_portfolio(self, datetime, portfolio, perf_tracker, recorded_vars):
          '''
          Store in Rethinkdb a zipline.Portfolio object
          '''
          if perf_tracker.progress != 0.0 and self.table:
  
              metrics = perf_tracker.to_dict()
              metrics.update({
                  'date': datetime,
                  'recorded': recorded_vars,
                  'portfolio': dbutils.portfolio_to_dict(portfolio)
              })
  
              log.debug('Saving metrics in database')
              log.debug(
                  rdb.table(self.table)
                     .insert(metrics)
                     .run(self.session)
              f save_portfolio(self, datetime, portfolio, perf_tracker, recorded_vars):
          '''
          Store in Rethinkdb a zipline.Portfolio object
          '''
          if perf_tracker.progress != 0.0 and self.table:
  
              metrics = perf_tracker.to_dict()
              metrics.update({
                  'date': datetime,
                  'recorded': recorded_vars,
                  'portfolio': dbutils.portfolio_to_dict(portfolio)
              })
  
              log.debug('Saving metrics in database')
              log.debug(
                  rdb.table(self.table)
                     .insert(metrics)
                     .run(self.session)
              )
docs: Store in Rethinkdb a zipline.Portfolio object