Most of Python 3 support

This isn't entirely finished, but I need to stop working on it for a bit, and I think enough of it is ready to be reviewed. The core code is passing its tests; the remaining failures are all in talking to the Scipy and netCDF4 backends. I also have PRs open against Scipy (scipy/scipy#3617) and netCDF4 (Unidata/netcdf4-python#252) to fix bugs I've encountered there.

Particular issues that came up:
- There were quite a few circular imports. For now, I've fudged these to work rather than trying to reorganise the code.
- `isinstance(x, int)` doesn't reliably catch numpy integer types - see e.g. numpy/numpy#2951. I changed several such cases to `isinstance(x, (int, np.integer))`.