def METHOD_NAME(x) -> str:
    if not isinstance(x, dict):
        return repr(x)
    value = x["value"]
    flags = dict(x["flags"])
    res = repr(value)
    if flags.get("directory", False):
        res = f"directory({res})"
        del flags["directory"]
    # TODO (kenny) ~ handle temporary values
    if "temp" in flags:
        del flags["temp"]
    if len(flags) != 0:
        raise RuntimeError(f"found unsupported flags: {repr(flags)}")
    return res