def normalize(self, scheme=True, host=True, path=True, query=True,
                  fragment=True, userinfo=True, percents=True):
        """Return a new URL object with several standard normalizations
        applied:

        * Decode unreserved characters (`RFC 3986 2.3`_)
        * Uppercase remaining percent-encoded octets (`RFC 3986 2.1`_)
        * Convert scheme and host casing to lowercase (`RFC 3986 3.2.2`_)
        * Resolve any "." and ".." references in the path (`RFC 3986 6.2.2.3`_)
        * Ensure an ending slash on URLs with an empty path (`RFC 3986 6.2.3`_)
        * Encode any stray percent signs (`%`) in percent-encoded
          fields (path, query, fragment, userinfo) (`RFC 3986 2.4`_)

        All are applied by default, but normalizations can be disabled
        per-part by passing `False` for that part's corresponding
        name.

        Args:
           scheme (bool): Convert the scheme to lowercase
           host (bool): Convert the host to lowercase
           path (bool): Normalize the path (see above for details)
           query (bool): Normalize the query string
           fragment (bool): Normalize the fragment
           userinfo (bool): Normalize the userinfo
           percents (bool): Encode isolated percent signs
              for any percent-encoded fields which are being
              normalized (defaults to True).

        >>> url = URL.from_text(u'Http://example.COM/a/../b/./c%2f?%61%')
        >>> print(url.normalize().to_text())
        http://example.com/b/c%2F?a%25

        .. _RFC 3986 3.2.2: https://tools.ietf.org/html/rfc3986#section-3.2.2
        .. _RFC 3986 2.3: https://tools.ietf.org/html/rfc3986#section-2.3
        .. _RFC 3986 2.1: https://tools.ietf.org/html/rfc3986#section-2.1
        .. _RFC 3986 6.2.2.3: https://tools.ietf.org/html/rfc3986#section-6.2.2.3
        .. _RFC 3986 6.2.3: https://tools.ietf.org/html/rfc3986#section-6.2.3
        .. _RFC 3986 2.4: https://tools.ietf.org/html/rfc3986#section-2.4

        """
        kw = {}
        if scheme:
            kw['scheme'] = self.scheme.lower()
        if host:
            kw['host'] = self.host.lower()
        def _dec_unres(target):
            return _decode_unreserved(target, normalize_case=True,
                                      encode_stray_percents=percents)
        if path:
            if self.path:
                kw['path'] = [_dec_unres(p) for p in _resolve_dot_segments(self.path)]
            else:
                kw['path'] = (u'',)
        if query:
            kw['query'] = [(_dec_unres(k), _dec_unres(v) if v else v)
                           for k, v in self.query]
        if fragment:
            kw['fragment'] = _dec_unres(self.fragment)
        if userinfo:
            kw['userinfo'] = u':'.join([_dec_unres(p)
                                        for p in self.userinfo.split(':', 1)])

        return self.replace(**kw)
Return a new URL object with several standard normalizations
        applied:

        * Decode unreserved characters (`RFC 3986 2.3`_)
        * Uppercase remaining percent-encoded octets (`RFC 3986 2.1`_)
        * Convert scheme and host casing to lowercase (`RFC 3986 3.2.2`_)
        * Resolve any "." and ".." references in the path (`RFC 3986 6.2.2.3`_)
        * Ensure an ending slash on URLs with an empty path (`RFC 3986 6.2.3`_)
        * Encode any stray percent signs (`%`) in percent-encoded
          fields (path, query, fragment, userinfo) (`RFC 3986 2.4`_)

        All are applied by default, but normalizations can be disabled
        per-part by passing `False` for that part's corresponding
        name.

        Args:
           scheme (bool): Convert the scheme to lowercase
           host (bool): Convert the host to lowercase
           path (bool): Normalize the path (see above for details)
           query (bool): Normalize the query string
           fragment (bool): Normalize the fragment
           userinfo (bool): Normalize the userinfo
           percents (bool): Encode isolated percent signs
              for any percent-encoded fields which are being
              normalized (defaults to True).

        >>> url = URL.from_text(u'Http://example.COM/a/../b/./c%2f?%61%')
        >>> print(url.normalize().to_text())
        http://example.com/b/c%2F?a%25

        .. _RFC 3986 3.2.2: https://tools.ietf.org/html/rfc3986#section-3.2.2
        .. _RFC 3986 2.3: https://tools.ietf.org/html/rfc3986#section-2.3
        .. _RFC 3986 2.1: https://tools.ietf.org/html/rfc3986#section-2.1
        .. _RFC 3986 6.2.2.3: https://tools.ietf.org/html/rfc3986#section-6.2.2.3
        .. _RFC 3986 6.2.3: https://tools.ietf.org/html/rfc3986#section-6.2.3
        .. _RFC 3986 2.4: https://tools.ietf.org/html/rfc3986#section-2.4

        
stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py