<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prepare_uri(self, path, query_params={}):
 """ Prepares a full URI with the selected information. ``path``: Path can be in one of two formats: - If :attr:`server` was defined, the ``path`` will be appended to the existing host, or - an absolute URL ``query_params``: Used to generate a query string, which will be appended to the end of the absolute URL. Returns an absolute URL. """

        query_str = urllib.urlencode(query_params)

        # If we have a relative path (as opposed to a full URL), build it of
        # the connection info
        if path.startswith('/') and self.server:
            protocol = self.protocol
            server = self.server
        else:
            protocol, server, path, _, _, _ = urlparse.urlparse(path)
            assert server, "%s is not a valid URL" % path

        return urlparse.urlunparse((
            protocol, server, path, None, query_str, None))