code: def add_position(p, name, pos):
      r"""Add a position to a portfolio.
  
      Parameters
      ----------
      p : alphapy.Portfolio
          Portfolio that will hold the position.
      name : int
          Unique identifier for the position, e.g., a stock symbol.
      pos : alphapy.Position
          New position to add to the portfolio.
  
      Returns
      -------
      p : alphapy.Portfolio
          Portfolio with the new position.
  
      """
      if name not in p.positions:
          p.positions[name] = pos
      return p
  
imports: from alphapy.frame import Frame
  from alphapy.frame import frame_name
  from alphapy.frame import read_frame
  from alphapy.frame import write_frame
  from alphapy.globals import MULTIPLIERS, SSEP
  from alphapy.globals import Orders
  from alphapy.space import Space
  import logging
  import math
  import numpy
  from pandas import DataFrame
  from pandas import date_range
  from pandas import Series
label_desc: Use image node_id 2 for calling a global function with example usage: add_position(p, name, pos) and returns: p