code: def output_positions(positions, positions_path):
      
      with open(positions_path, 'w') as f:
          for position in positions:
              f.write("%s\n" % position)
docs: Output the positions of an image to a positions.dat file.
  
      Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \
      multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \
      one another are resampled during the non-linear search.
  
      Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \
      correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \
      lines of the same positions file.
  
      Parameters
      ----------
      positions : [[[]]]
          The lists of positions (e.g. [[[1.0, 1.0], [2.0, 2.0]], [[3.0, 3.0], [4.0, 4.0]]])
      positions_path : str
          The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')