def sibling(self, segment):
        """Make a new :class:`URL` with a single path segment that is a
        sibling of this URL path.

        Args:
           segment (unicode): A single path segment.

        Returns:
           URL: A copy of the current URL with the last path segment
              replaced by *segment*. Special characters such as
              ``/?#`` will be percent encoded.

        """
        _textcheck('path segment', segment)
        new_path = self.path[:-1] + (_encode_path_part(segment),)
        return self.replace(path=new_path)
Make a new :class:`URL` with a single path segment that is a
        sibling of this URL path.

        Args:
           segment (unicode): A single path segment.

        Returns:
           URL: A copy of the current URL with the last path segment
              replaced by *segment*. Special characters such as
              ``/?#`` will be percent encoded.

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