'Convert connection parameters to URL form.'

def as_uri(self, include_password=False, mask=u'**', getfields=itemgetter(u'port', u'userid', u'password', u'virtual_host', u'transport')):

    hostname = (self.hostname or u'localhost')
    if self.transport.can_parse_url:
        if self.uri_prefix:
            return (u'%s+%s' % (self.uri_prefix, hostname))
        return self.hostname
    if self.uri_prefix:
        return (u'%s+%s' % (self.uri_prefix, hostname))
    fields = self.info()
    (port, userid, password, vhost, transport) = getfields(fields)
    return as_url(transport, hostname, port, userid, password, quote(vhost), sanitize=(not include_password), mask=mask)
