code: public void write_pid(OtpErlangPid pid) {
  	write1(pid.tag());
  	write_atom(pid.node());
  	write4BE(pid.id());
  	write4BE(pid.serial());
  	switch (pid.tag()) {
  	case OtpExternal.pidTag:
  	    write1(pid.creation());
  	    break;
  	case OtpExternal.newPidTag:
  	    write4BE(pid.creation());
  	    break;
  	default:
  	    throw new AssertionError("Invalid pid tag " + pid.tag());
  	}
      }
docs: Write an Erlang PID to the stream.
  
  @param pid
  the pid