human
I wrote the below code

    def decorator(func):
        @functools.wraps(func)
        def wrapper(cls):
            has_local_network = False
            try:
                pubsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                retsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                pubsock.bind(('', 18000))
                pubsock.close()
                retsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                retsock.bind(('', 18001))
                retsock.close()
                has_local_network = True
            except socket.error:
                try:
                    pubsock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
                    retsock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
                    pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                    pubsock.bind(('', 18000))
                    pubsock.close()
                    retsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                    retsock.bind(('', 18001))
                    retsock.close()
                    has_local_network = True
                except socket.error:
                    pass
            if (only_local_network is True):
                if (has_local_network is False):
                    cls.skipTest('No    local    network    was    detected')
                return func(cls)
            for addr in ('173.194.41.198', '173.194.41.199', '173.194.41.200', '173.194.41.201', '173.194.41.206', '173.194.41.192', '173.194.41.193', '173.194.41.194', '173.194.41.195', '173.194.41.196', '173.194.41.197'):
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                try:
                    sock.settimeout(0.25)
                    sock.connect((addr, 80))
                    break
                except socket.error:
                    continue
                else:
                   ...

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def requires_network(only_local_network=False):