def METHOD_NAME(parsed: list[t.Any]) -> str:
    bits: list[str] = []
    for part in parsed:
        if isinstance(part, string_type):
            if part.isidentifier():
                fmt = ".%s" if bits else "%s"
            elif part == "":
                fmt = ".%s" if bits else "%s"
            else:
                fmt = '."%s"' if bits else '"%s"'
        else:
            fmt = "[%d]"
        bits.append(fmt % part)
    return "".join(bits)