def parse_regulon_str(regulon_str, trn):
    """
    Converts a complex regulon (regulon_str) into a list of genes

    Parameters
    ----------
    regulon_str : str
        Complex regulon, where "/" uses genes in any regulon and "+" uses
        genes in all regulons
    trn : ~pandas.DataFrame
        Table containing transcriptional regulatory network

    Returns
    -------
    reg_genes : set
        Set of genes regulated by regulon_str
    """

    if regulon_str == "":
        return set()
    if "+" in regulon_str and "/" in regulon_str:
        raise NotImplementedError(
            'Complex regulons cannot contain both "+" ' '(AND) and "/" (OR) operators'
        )
    elif "+" in regulon_str:
        join = set.intersection
        regs = regulon_str.split("+")
    elif "/" in regulon_str:
        join = set.union
        regs = regulon_str.split("/")
    else:
        join = set.union
        regs = [regulon_str]

    # Combine regulon
    reg_genes = join(*[set(trn[trn.regulator == reg].gene_id) for reg in regs])
    return reg_genes