anchor.diff:  
   %% External exports
   -export([
  -	start/0, start_link/0, start_link/1,
  -	parse/1, parse/2
  +	start_link/1, parse/1, parse/2
   ]).
   
   %% gen_server callbacks
   -export([init/1, handle_call/3, handle_cast/2,
   	handle_info/2, code_change/3, terminate/2]).
   
  --define(RETRY,   1).
  --define(PORT_TIMEOUT, 30000).
  --define(TIMEOUT, ?PORT_TIMEOUT*16).
  +-define(TIMEOUT, 120000).
   
  --record(state, {port}).
  +-record(state, {port, queue = queue:new()}).
   
  -start() ->
  -	gen_server:start(?MODULE, [], []).
   start_link(_) ->
  -	start_link().
  -start_link() ->
   	gen_server:start_link(?MODULE, [], []).
   
   parse(Data) ->
  
positive.code: 
  terminate(_Reason, _State) ->
  	ok.
  
  %% ===================================================================
  
  start_port() ->
  	Dir = case code:priv_dir(?MODULE) of
  		{error, _} -> filename:join( [ filename:dirname(code:which(?MODULE)), "..", "priv" ] );
  		PrivDir -> PrivDir
  	end,
  	Python = filename:join(Dir, "./python"),
  	open_port({spawn_executable, Python}, [{packet, 4}, binary, use_stdio, {cd, Dir}, {args, ["./feedparser-port.py"]}]).
  
  restart_port(Port) ->
  	catch port_close(Port),
  	start_port().
  
negative.code: %% ===================================================================
  
  init(_) ->
  	Dir = case code:priv_dir(?MODULE) of
  		{error, _} -> filename:join( [ filename:dirname(code:which(?MODULE)), "..", "priv" ] );
  		PrivDir -> PrivDir
  	end,
  	Python = filename:join(Dir, "./python"),
  	Port = open_port({spawn_executable, Python},
  		[{packet, 4}, binary, use_stdio, exit_status, {cd, Dir}, {args, ["./feedparser-port.py"]}]
  	),
  	{ok, #state{port = Port}}.
  
  handle_call({parse, Data, Headers}, From, #state{port = Port, queue = Queue} = State) ->
  	port_command(Port, term_to_binary({parse, Data, Headers})),
  	{noreply, State#state{queue = queue:in(From, Queue)}}.
  
  handle_cast(_Request, State) ->
  	{noreply, State}.
  
  handle_info({Port, {data, Data}}, #state{port = Port, queue = FQueue} = State) ->
  	{{value, From}, Queue} = queue:out(FQueue),
  	gen_server:reply(From, binary_to_term(Data)),
  	{noreply, State#state{queue = Queue}};
  handle_info({Port, {exit_status, _Code}}, #state{port = Port} = State) ->
  	{stop, port_exit, State};
  handle_info(_Info, State) ->
  	{noreply, State}.
  
  