code: def portfolio_snapshot(p):
      """Extract all of the fields from the portfolio as a new dictionary."""
      fields = (
          "cash_flow",
          "starting_cash",
          "portfolio_value",
          "pnl",
          "returns",
          "cash",
          "positions",
          "positions_value",
          "positions_exposure",
      )
      return {field: getattr(p, field) for field in fields}
  
imports: import unittest
  import numpy
  import pandas
  from zipline import api
  from zipline.assets import Equity, Future
  from zipline.assets.synthetic import make_commodity_future_info
  from zipline.data.data_portal import DataPortal
  from zipline.data.resample import MinuteResampleSessionBarReader
  from zipline.testing import parameter_space, prices_generating_returns, simulate_minutes_for_day
  from zipline.testing.fixtures import WithMakeAlgo, WithConstantEquityMinuteBarData, WithConstantFutureMinuteBarData, WithWerror, ZiplineTestCase
  from zipline.testing.predicates import assert_equal, wildcard
label_desc: Use image node_id 2 for calling a global function with example usage: portfolio_snapshot(p) and returns: unknown