I do this in pyBigWig, but I'm told that some programs using this do not check to ensure that intervals are entered in a sane order. The various add/append functions should add a checkConsistency parameter. This will result in a new minor version, due to the change in API. I should also start adding .1 or whatever to the .so file.