updated version of andy buchanan's old python patent parser