def _is_ipv6_enabled():
if socket.has_ipv6:<EOL><INDENT>sock = None<EOL>try:<EOL><INDENT>sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)<EOL>sock.bind(('<STR_LIT>', <NUM_LIT:0>))<EOL>return True<EOL><DEDENT>except (socket.error, socket.gaierror):<EOL><INDENT>pass<EOL><DEDENT>finally:<EOL><INDENT>if sock:<EOL><INDENT>sock.close()<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Check whether IPv6 is enabled on this host.