def write_json_flag(flag, fobj, **kwargs):
<EOL>if isinstance(fobj, string_types):<EOL><INDENT>with open(fobj, '<STR_LIT:w>') as fobj2:<EOL><INDENT>return write_json_flag(flag, fobj2, **kwargs)<EOL><DEDENT><DEDENT>data = {}<EOL>data['<STR_LIT>'] = flag.ifo<EOL>data['<STR_LIT:name>'] = flag.tag<EOL>data['<STR_LIT:version>'] = flag.version<EOL>data['<STR_LIT>'] = flag.active<EOL>data['<STR_LIT>'] = flag.known<EOL>data['<STR_LIT>'] = {}<EOL>data['<STR_LIT>']['<STR_LIT>'] = not flag.isgood<EOL>data['<STR_LIT>']['<STR_LIT>'] = flag.description<EOL>json.dump(data, fobj, **kwargs)<EOL>
Write a `DataQualityFlag` to a JSON file

    Parameters
    ----------
    flag : `DataQualityFlag`
        data to write

    fobj : `str`, `file`
        target file (or filename) to write

    **kwargs
        other keyword arguments to pass to :func:`json.dump`

    See also
    --------
    json.dump
        for details on acceptable keyword arguments