<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _build(self, constraint_spec):
 """Generate queries to execute. Sets instance variables so that Mongo query strings, etc. can now be extracted from the object. :param constraint_spec: Constraint specification :type constraint_spec: ConstraintSpec """

        self._sections = []

        # For each condition in the spec

        for sval in constraint_spec:
            rpt_fld = self._base_report_fields.copy()
            #print("@@ CONDS = {}".format(sval.filters))
            #print("@@ MAIN = {}".format(sval.constraints))

            # Constraints

            # If the constraint is an external call to Python code
            if self._is_python(sval.constraints):
                query, proj = self._process_python(sval.constraints)
                rpt_fld.update(proj.to_mongo())

            # All other constraints, e.g. 'foo > 12'
            else:
                query = MongoQuery()
                if sval.constraints is not None:
                    groups = self._process_constraint_expressions(sval.constraints)
                    projection = Projection()
                    for cg in groups.values():
                        for c in cg:
                            projection.add(c.field, c.op, c.value)
                            query.add_clause(MongoClause(c))
                        if self._add_exists:
                            for c in cg.existence_constraints:
                                query.add_clause(MongoClause(c, exists_main=True))
                    rpt_fld.update(projection.to_mongo())

            # Filters

            cond_query = MongoQuery()
            if sval.filters is not None:
                cond_groups = self._process_constraint_expressions(sval.filters, rev=False)
                for cg in cond_groups.values():
                    for c in cg:
                        cond_query.add_clause(MongoClause(c, rev=False))

            # Done. Add a new 'SectionPart' for the filter and constraint

            result = self.SectionParts(cond_query, query, sval.sampler, rpt_fld)
            self._sections.append(result)