def secure(self, secure=True, port=None):

        # Choose the scheme and default port.
        if secure:
            scheme, defaultPort = 'https', 443
        else:
            scheme, defaultPort = 'http', 80

        # Rebuild the netloc with port if not default.
        netloc = self.netloc.split(':',1)[0]
        if port is not None and port != defaultPort:
            netloc = '%s:%d' % (netloc, port)

        return self.cloneURL(
            scheme, netloc, self._qpathlist, self._querylist, self.fragment)

    ## fragment/anchor manipulation
returns a mock object with socket.socket interface
dataset/ETHPy150Open twisted/nevow/nevow/url.py/URL.secure--crossover with--dataset/ETHPy150Open pyGrowler/Growler/tests/mocks/__init__.py/mock_socket