WIP adds callback hooks. network.py: Use explicit errno for dns socket errors.

WIP adds explicit callback hooks into classes instead of subclassing.
Allows attaching callbacks to other parts of the code, ie, phantomjs so
phantomjs codepath can also be controlled by scripting.

network.py: Uses explicit errno during exception handling to distinguish
lookup failures and network failures.

[ci skip]
network.Resolver: WIP Uses AF_UNSPEC flag instead. Rename param to family.

Use of AF_INET | AF_INET6 may fail for things such as localhost.

[ci skip]
hook.py: Implements remaining script hooks.
Cleans up commented-out code.
network.Resolver: Implements IPv4/6 perference sorting.
changelog: Adds entries about HookableMixin and Resolver param change.
network.Resolver: Defaults family PREFER_IPv4 for backward compatibility
network.Resolver: Fixes address preference sorting.
builder.py: Defaults back to IPv4 preference for backward compatiblity
hook.py: Fixes lua type conversion on exit status callback.
Merge branch 'topic/callback_hooks' into develop