code: def _render_condition(field, field_type, comparators):
      
  
      field_type = field_type.upper()
  
      negated_conditions, normal_conditions = [], []
  
      for comparator in comparators:
          condition = comparator.get("condition").upper()
          negated = "NOT " if comparator.get("negate") else ""
          value = comparator.get("value")
  
          if condition == "IN":
              if isinstance(value, (list, tuple, set)):
                  value = ', '.join(
                      sorted([_render_condition_value(v, field_type)
                              for v in value])
                  )
              else:
                  value = _render_condition_value(value, field_type)
              value = "(" + value + ")"
          elif condition == "IS NULL" or condition == "IS NOT NULL":
              return field + " " + condition
          elif condition == "BETWEEN":
              if isinstance(value, (tuple, list, set)) and len(value) == 2:
                  value = ' AND '.join(
                      sorted([_render_condition_value(v, field_type)
                              for v in value])
                  )
              elif isinstance(value, (tuple, list, set)) and len(value) != 2:
                  logger.warn('Invalid condition passed in: %s' % condition)
  
          else:
              value = _render_condition_value(value, field_type)
  
          rendered_sub_condition = "%s%s %s %s" % (
              negated, field, condition, value)
  
          if comparator.get("negate"):
              negated_conditions.append(rendered_sub_condition)
          else:
              normal_conditions.append(rendered_sub_condition)
  
      rendered_normal = " AND ".join(normal_conditions)
      rendered_negated = " AND ".join(negated_conditions)
  
      if rendered_normal and rendered_negated:
          return "((%s) AND (%s))" % (rendered_normal, rendered_negated)
  
      return "(%s)" % (rendered_normal or rendered_negated)
docs: Render a single query condition.
  
      Parameters
      ----------
      field : str
          The field the condition applies to
      field_type : str
          The data type of the field.
      comparators : array_like
          An iterable of logic operators to use.
  
      Returns
      -------
      str
          a condition string.