Fix to_int28.

The format for 28 bit records is:

| <------------- node --------------->|
| 23 .. 0 | 27..24 | 27..24 | 23 .. 0 |

Yes, really.
Raise a more useful error for unusual record sizes.

The spec says that "A record may be anywhere from 24 to 128 bits long,
dependending on the number of nodes in the tree."  The spec also gives
three examples for 24, 28, and 32 bits, but that doesn't mean records
can't be 36 bits long in a few years from now.
Fix get_type_and_len for 32 bit pointers.

The spec says: "Finally, if the size is 3, the pointer's value is
contained in the next four bytes as a 32-bit value. In this case, the last
three bits of the control byte are ignored."
Don't dump None entries.
Don't dump IPv4 addresses in dump_item_ipv6.

When dumping IPv6 addresses, we have to skip IPv4 addresses which are
contained three times in the binary search tree:

 1. "When storing IPv4 addresses in an IPv6 tree, they are stored as-is,
    so they occupy the first 32-bits of the address space (from 0 to
    2**32 - 1)."

 2. "The strategy that MaxMind uses for its GeoIP databases is to include
    a pointer from the ::ffff:0:0/80 [sic!] subnet to the root node of the
    IPv4 address space in the tree. This accounts for the IPv4-mapped IPv6
    address."  The correct subnet is ::ffff:0:0/96.

 3. "MaxMind also includes a pointer from the 2002::/16 subnet to the root
    node of the IPv4 address space in the tree. This accounts for the 6to4
    mapping subnet."
Pass dump_item as parameter to dump_tree.

We'll want to dump both IPv4 and IPv6 entries in the same run, and
redefining dump_item after dumping IPv4 entries seems like a hack.
Change how we dump entries without country information.

 - Dump the MaxMind-specific continent code ("EU" for Europe, "AP" for
   Asia Pacific Region) if there's no country code.
 - Don't dump anything for entries that have neither country nor continent
   information, rather than dumping them as "??".  The tools that use our
   output will automatically assume "??" for everything that's not in the
   file.
Move import to the top.
Write to geoip and geoip6 files.
Merge adjacent entries with the same country code.

When dumping the tree, dump it to a list of (lo, hi, val) tuples first,
and then go through tuples and merge them if possible.
Include header containing the database build date.
Remove continent codes.

Partially reverts 70413399c3e251a4a8aafe98ac450d0237a40f55.
Merge remote-tracking branch 'karsten/master'