def enable(cls, allow_net_connect=True):
        """Enables HTTPretty.
        When ``allow_net_connect`` is ``False`` any connection to an unregistered uri will throw :py:class:`httpretty.errors.UnmockedError`.

        .. testcode::

           import re, json
           import httpretty

           httpretty.enable()

           httpretty.register_uri(
               httpretty.GET,
               re.compile(r'http://.*'),
               body=json.dumps({'man': 'in', 'the': 'middle'})
           )

           response = requests.get('https://foo.bar/foo/bar')

           response.json().should.equal({
               "man": "in",
               "the": "middle",
           })

        .. warning:: after calling this method the original :py:mod:`socket` is replaced with :py:class:`httpretty.core.fakesock`. Make sure to call :py:meth:`~httpretty.disable` after done with your tests or use the :py:class:`httpretty.enabled` as decorator or `context-manager <https://docs.python.org/3/reference/datamodel.html#context-managers>`_
        """
        cls.allow_net_connect = allow_net_connect
        cls._is_enabled = True
        # Some versions of python internally shadowed the
        # SocketType variable incorrectly https://bugs.python.org/issue20386
        bad_socket_shadow = (socket.socket != socket.SocketType)

        socket.socket = fakesock.socket
        socket._socketobject = fakesock.socket
        if not bad_socket_shadow:
            socket.SocketType = fakesock.socket

        socket.create_connection = create_fake_connection
        socket.gethostname = fake_gethostname
        socket.gethostbyname = fake_gethostbyname
        socket.getaddrinfo = fake_getaddrinfo

        socket.__dict__['socket'] = fakesock.socket
        socket.__dict__['_socketobject'] = fakesock.socket
        if not bad_socket_shadow:
            socket.__dict__['SocketType'] = fakesock.socket

        socket.__dict__['create_connection'] = create_fake_connection
        socket.__dict__['gethostname'] = fake_gethostname
        socket.__dict__['gethostbyname'] = fake_gethostbyname
        socket.__dict__['getaddrinfo'] = fake_getaddrinfo

        if socks:
            socks.socksocket = fakesock.socket
            socks.__dict__['socksocket'] = fakesock.socket

        if ssl:
            new_wrap = partial(fake_wrap_socket, old_ssl_wrap_socket)
            ssl.wrap_socket = new_wrap
            ssl.SSLSocket = FakeSSLSocket
            try:
                ssl.SSLContext.wrap_socket = partial(fake_wrap_socket, old_sslcontext_wrap_socket)
            except AttributeError:
                pass

            ssl.__dict__['wrap_socket'] = new_wrap
            ssl.__dict__['SSLSocket'] = FakeSSLSocket

            if not PY3:
                ssl.sslwrap_simple = new_wrap
                ssl.__dict__['sslwrap_simple'] = new_wrap

        if requests_urllib3_connection is not None:
            new_wrap = partial(fake_wrap_socket, old_requests_ssl_wrap_socket)
            requests_urllib3_connection.ssl_wrap_socket = new_wrap
            requests_urllib3_connection.__dict__['ssl_wrap_socket'] = new_wrap