def decorate_position_with_prices(position, price, previous_price):
  
  position.price = price
  position.previous_price = previous_price
  
  position.market_value = position.quantity * position.price
  position.previous_market_value = position.quantity * position.previous_price
  position.pl = (position.market_value - position.cost_basis)
  position.pl_percent = (((position.pl / position.cost_basis) * 100) if position.cost_basis != 0 else 0)
  position.day_pl = (position.market_value - position.previous_market_value)
  position.day_pl_percent = (((position.day_pl / position.previous_market_value) * 100) if position.previous_market_value != 0 else 0)
Capture the output of sys.stdout:
dataset/ETHPy150Open fxdemolisher/frano/frano/positions/models.py/decorate_position_with_prices--crossover with--dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/test/support.py/captured_stdout