def _tf_combo_string(row):
    """
    Creates a formatted string for the histogram legends. Helper function for
    imdb_gene_hist_df.

    Parameters
    ----------
    row : ~pandas.Series
        Boolean series indexed by TFs for a given gene

    Returns
    -------
    str
        A string formatted for display (i.e. "Regulated by ...")
    """
    if row.sum() == 0:
        return "unreg"
    if row.sum() == 1:
        return row.index[row][0]
    if row.sum() == 2:
        return " and ".join(row.index[row])
    else:
        return ", ".join(row.index[row][:-1]) + ", and " + row.index[row][-1]