def _parse_regulon_string(model, s):
    """
    The Bacillus microarray dataset uses [] to create unusually complicated
    TF strings. This function parses those, as a helper to _get_reg_genes for
    imdb_regulon_venn_df.

    Parameters
    ----------
    model : :class:`~pymodulon.core.IcaData`
        IcaData object
    s : str
        TF string

    Returns
    -------
    res: set
        Set of genes regulated by this string
    """

    res = set()
    if not (isinstance(s, str)):
        return res
    if "/" in s:
        union = s.split("] / [")
        union[0] = union[0][1:]
        union[-1] = union[-1][:-1]
    else:
        union = [s]
    for r in union:
        if "+" in r:
            intersection = r.split(" + ")
            genes = set(model.trn.gene_id[model.trn.regulator == intersection[0]])
            for i in intersection[1:]:
                genes = genes.intersection(
                    set(model.trn.gene_id[model.trn.regulator == i])
                )
        else:
            genes = set(model.trn.gene_id[model.trn.regulator == r])
        res = res.union(genes)
    return res