def to_json(self, fname: Union[(str, Path)], open_kwargs: dict={}) -> int:
    jblob = json.dumps(asdict(self))
    with fsspec.open(str(fname), mode='wt', **open_kwargs) as fh:
        result = fh.write(jblob)
    return result
def to_json(self, fname: Union[(str, Path)], open_kwargs: dict={}) -> int:
    jblob = json.dumps(asdict(self))
    with fsspec.open(str(fname), mode='wt', **open_kwargs) as fh:
        result = fh.write(jblob)
    return result