def process_custom_field(connection, project_id, cf_type, cf_name, value_names=None):
    _create_custom_field_prototype(connection, cf_type, cf_name)
    if cf_type[0:-3] not in connection.bundle_types:
        value_names = None
    elif value_names is None:
        value_names = []

    existing_project_fields = [item for item in connection.getProjectCustomFields(project_id) if
                               item.name.encode('utf-8') == cf_name]
    values_to_add = []
    bundle = None
    if len(existing_project_fields):
        if value_names is None:
            return
        bundle = connection.getBundle(cf_type, existing_project_fields[0].bundle)
        values_to_add = calculate_missing_value_names(bundle, value_names)
    else:
        if value_names is None:
            connection.createProjectCustomFieldDetailed(project_id, cf_name, "No " + cf_name)
            return
        bundle = create_bundle_safe(connection, cf_name + "_bundle_" + project_id, cf_type)
        values_to_add = calculate_missing_value_names(bundle, value_names)
        connection.createProjectCustomFieldDetailed(project_id, cf_name, "No " + cf_name,
                                                    params={"bundle": bundle.name})
    [connection.addValueToBundle(bundle, bundle.createElement(name)) for name in values_to_add]
Can add product with initial environment profile.
dataset/ETHPy150Open gini/youtrack-githook/youtrack/importHelper.py/process_custom_field--crossover with--dataset/ETHPy150Open mozilla/moztrap/tests/view/manage/products/test_forms.py/AddProductFormTest.test_add_product_with_profile