def authority(self, with_password=False, **kw):
        """Compute and return the appropriate host/port/userinfo combination.

        >>> url = URL.from_text(u'http://user:pass@localhost:8080/a/b?x=y')
        >>> url.authority()
        u'user:@localhost:8080'
        >>> url.authority(with_password=True)
        u'user:pass@localhost:8080'

        Args:
           with_password (bool): Whether the return value of this
              method include the password in the URL, if it is
              set. Defaults to False.

        Returns:
           str: The authority (network location and user information) portion
              of the URL.
        """
        # first, a bit of twisted compat
        with_password = kw.pop('includeSecrets', with_password)
        if kw:
            raise TypeError('got unexpected keyword arguments: %r' % kw.keys())
        host = self.host
        if ':' in host:
            hostport = ['[' + host + ']']
        else:
            hostport = [self.host]
        if self.port != SCHEME_PORT_MAP.get(self.scheme):
            hostport.append(unicode(self.port))
        authority = []
        if self.userinfo:
            userinfo = self.userinfo
            if not with_password and u":" in userinfo:
                userinfo = userinfo[:userinfo.index(u":") + 1]
            authority.append(userinfo)
        authority.append(u":".join(hostport))
        return u"@".join(authority)
Compute and return the appropriate host/port/userinfo combination.

        >>> url = URL.from_text(u'http://user:pass@localhost:8080/a/b?x=y')
        >>> url.authority()
        u'user:@localhost:8080'
        >>> url.authority(with_password=True)
        u'user:pass@localhost:8080'

        Args:
           with_password (bool): Whether the return value of this
              method include the password in the URL, if it is
              set. Defaults to False.

        Returns:
           str: The authority (network location and user information) portion
              of the URL.
        
stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py