'Given a Cursor instance, return an url with encoded cursor.'

def encode_cursor(self, cursor):

    tokens = {}
    if (cursor.offset != 0):
        tokens[u'o'] = str(cursor.offset)
    if cursor.reverse:
        tokens[u'r'] = u'1'
    if (cursor.position is not None):
        tokens[u'p'] = cursor.position
    querystring = urlparse.urlencode(tokens, doseq=True)
    encoded = b64encode(querystring.encode(u'ascii')).decode(u'ascii')
    return replace_query_param(self.base_url, self.cursor_query_param, encoded)
