

def _recursive_custom_to_dfp(targeting):
    '\n    Convert custom targeting model to dfp dictionary\n\n    @param targeting: TargetingCriterion\n    @return: dict\n    '
    (operator, targets) = targeting.get_data()
    if (operator == TargetingCriterion.OPERATOR.NOT):
        (operator, targets) = targets[0].get_data()
        is_operator = 'IS_NOT'
    else:
        is_operator = 'IS'
    if isinstance(targets[0], Custom):
        children = _custom_target_list_to_child_list(targets, is_operator)
    elif (len(targets) == 1):
        return _recursive_custom_to_dfp(c[0])
    else:
        children = [_recursive_custom_to_dfp(c) for c in targets]
    return {
        'xsi_type': 'CustomCriteriaSet',
        'children': children,
        'logicalOperator': operator,
    }

dataset/ETHPy150Open chartbeat-labs/parselmouth/parselmouth/adapters/dfp/targeting_utils.py _recursive_custom_to_dfp/VarMisuse@104/194 `targets`->`c`