def setup_constraint(name,style):
    gauss_constraint=user.gauss_constraints.get().get(name)
    contour_constraint=user.contour_constraints.get().get(name)
    mneu_mg_m12g_m3g_X2_lookup=user.mneu_mg_m12g_m3g_X2_lookups.get().get(name)
    if gauss_constraint is not None:
        gauss_constraint=add_array_ids(gauss_constraint,style)
        tools.add_gauss_constraints({name:gauss_constraint})
    elif contour_constraint is not None:
        contours=tools.populate_contours(user.contours.get())
        tools.add_contours(contours)
        contour_constraint=add_array_ids(contour_constraint,style)
        tools.add_contour_constraints({name:contour_constraint})
    elif mneu_mg_m12g_m3g_X2_lookup is not None:
        mneu_mg_m12g_m3g_X2_lookup=add_array_ids(mneu_mg_m12g_m3g_X2_lookup,style)
        lookups={name:mneu_mg_m12g_m3g_X2_lookup}
        lookups=tools.populate_mneu_mg_m12g_m3g_X2_lookups(lookups)
        tools.add_mneu_mg_m12g_m3g_X2_lookups(lookups)
    else:
        print('{} not found in gauss or contour constraints.\Exiting'.format(name))
        exit()
 else:
     first_two_columns=['points_rowid','rowid']
 columns=','.join(first_two_columns+[ oid_column_dict[oid] for oid in array_ids_dict.keys()])
 sql_where=''
 if args.sql_where is not None:
     sql_where='where ' + args.sql_where
 sql_selection='select  {} from points {};'.format(columns,sql_where)
 print('the sql query is:\n{}'.format(sql_selection))
 # get unique items in the list ordered
 vars_lookups=tools.populate_with_array_ids(vars_lookups,style,array_ids_dict)
 vars_functions=tools.populate_with_array_ids(vars_functions,style,array_ids_dict)
 gauss_constraints=tools.populate_with_array_ids(gauss_constraints,style,array_ids_dict)
 contour_constraints=tools.populate_with_array_ids(contour_constraints,style,array_ids_dict)
 mneu_mg_m12g_m3g_X2_lookups=tools.populate_with_array_ids(mneu_mg_m12g_m3g_X2_lookups,style,array_ids_dict)
 # pupulate mneu_mg_m12g_m3g_X2_lookups with the lookup data
 mneu_mg_m12g_m3g_X2_lookups=tools.populate_mneu_mg_m12g_m3g_X2_lookups(mneu_mg_m12g_m3g_X2_lookups)
 # populate contours and add to managers
 contours=tools.populate_contours(user.contours.get())
 tools.add_contours(contours)
 # now add values to the managers
 tools.add_vars_lookups(vars_lookups) 
 tools.add_vars_functions(vars_functions) 
 tools.add_gauss_constraints(gauss_constraints)
 tools.add_contour_constraints(contour_constraints)
 tools.add_mneu_mg_m12g_m3g_X2_lookups(mneu_mg_m12g_m3g_X2_lookups)
 # look for chi2 calculators
 if args.reference in user.constraints_sets.constraints.keys():
     tools.add_chi2_calculator(args.reference,user.constraints_sets.get(args.reference))
 # axes and spaces to managers
 tools.add_axes(axes)
 tools.pp(spaces)