docs: def _format_filter(filters, and_props=[]):
          """
          Transform filters to a comprehensive WQL `WHERE` clause.
  
          Builds filter from a filter list.
          - filters: expects a list of dicts, typically:
                  - [{'Property': value},...] or
                  - [{'Property': (comparison_op, value)},...]
  
                  NOTE: If we just provide a value we defailt to '=' comparison operator.
                  Otherwise, specify the operator in a tuple as above: (comp_op, value)
                  If we detect a wildcard character ('%') we will override the operator
                  to use LIKE
          """
  
          def build_where_clause(fltr):
              f = fltr.pop()
              wql = ""
              while f:
                  prop, value = f.popitem()
  
                  if isinstance(value, tuple):
                      oper = value[0]
                      value = value[1]
                  elif isinstance(value, string_types) and '%' in value:
                      oper = 'LIKE'
                  else:
                      oper = '='
  
                  if isinstance(value, list):
                      if not len(value):
                          continue
  
                      internal_filter = map(
                          lambda x: (prop, x)
                          if isinstance(x, tuple)
                          else (prop, ('LIKE', x))
                          if '%' in x
                          else (prop, (oper, x)),
                          value,
                      )
  
                      bool_op = ' OR '
                      for p in and_props:
                          if p.lower() in prop.lower():
                              bool_op = ' AND '
                              break
  
                      clause = bool_op.join(
                          [
                              '{0} {1} \'{2}\''.format(k, v[0], v[1])
                              if isinstance(v, tuple)
                              else '{0} = \'{1}\''.format(k, v)
                              for k, v in internal_filter
                          ]
                      )
  
                      if bool_op.strip() == 'OR':
                          wql += "( {clause} )".format(clause=clause)
                      else:
                          wql += "{clause}".format(clause=clause)
  
                  else:
                      wql += "{property} {cmp} '{constant}'".format(property=prop, cmp=oper, constant=value)
                  if f:
                      wql += " AND "
  
              # empty list skipped
              if wql.endswith(" AND "):
                  wql = wql[:-5]
  
              if len(fltr) == 0:
                  return "( {clause} )".format(clause=wql)
  
              return "( {clause} ) OR {more}".format(clause=wql, more=build_where_clause(fltr))
  
          if not filters:
              return ""
  
          return " WHERE {clause}".format(clause=build_where_clause(filters))