<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_uniq_value_to_dict_bf(d, k, v):
 """Like _add_value_to_dict_bf but will not add v if another element in under key `k` has the same value. """

    prev = d.get(k)
    if prev is None:
        d[k] = v
    elif isinstance(prev, list):
        if not isinstance(v, list):
            v = [v]
        for sel in v:
            found = False
            for el in prev:
                if el == sel:
                    found = True
                    break
            if not found:
                prev.append(sel)
    else:
        if isinstance(v, list):
            prev = [prev]
            for sel in v:
                found = False
                for el in prev:
                    if el == sel:
                        found = True
                        break
                if not found:
                    prev.append(sel)
            if len(prev) > 1:
                d[k] = prev
        elif prev != v:
            d[k] = [prev, v]