def objectify_uri(relative_uri):
    '''Converts uris from path syntax to a json-like object syntax.
    In addition, url escaped characters are unescaped, but non-ascii
    characters a romanized using the unidecode library.

    Examples:
       "/blog/3/comments" becomes "blog[3].comments"
       "car/engine/piston" becomes "car.engine.piston"
    '''
    def path_clean(chunk):
        if not chunk:
            return chunk
        if re.match(r'\d+$', chunk):
            return '[{0}]'.format(chunk)
        else:
            return '.' + chunk

    if six.PY2:
        byte_arr = relative_uri.encode('utf-8')
    else:
        byte_arr = relative_uri
    unquoted = decode(unquote(byte_arr), 'utf-8')
    nice_uri = unidecode.unidecode(unquoted)
    return ''.join(path_clean(c) for c in nice_uri.split('/'))
Converts uris from path syntax to a json-like object syntax.
    In addition, url escaped characters are unescaped, but non-ascii
    characters a romanized using the unidecode library.

    Examples:
       "/blog/3/comments" becomes "blog[3].comments"
       "car/engine/piston" becomes "car.engine.piston"