Rewrite to_long_ipv{4,6} using struct.unpack