docs: def parse_condition(self, query, prev_key=None, last_prev_key=None):
          """
          Creates a recursive generator for parsing some types of Query()
          conditions
  
          :param query: Query object
          :param prev_key: The key at the next-higher level
          :return: generator object, the last of which will be the complete
          Query() object containing all conditions
          """
          # use this to determine gt/lt/eq on prev_query
          logger.debug(u'query: {} prev_query: {}'.format(query, prev_key))
  
          q = Query()
          conditions = None
  
          # deal with the {'name': value} case by injecting a previous key
          if not prev_key:
              temp_query = copy.deepcopy(query)
              k, v = temp_query.popitem()
              prev_key = k
  
          # deal with the conditions
          for key, value in query.items():
              logger.debug(u'conditions: {} {}'.format(key, value))
  
              if key == u'$gte':
                  conditions = (
                      Q(q, prev_key) >= value
                  ) if not conditions and prev_key != "$not" \
                  else (conditions & (Q(q, prev_key) >= value)) if prev_key != "$not" \
                  else (q[last_prev_key] < value)
              elif key == u'$gt':
                  conditions = (
                      Q(q, prev_key) > value
                  ) if not conditions and prev_key != "$not" \
                  else (conditions & (Q(q, prev_key) > value)) if prev_key != "$not" \
                  else (q[last_prev_key] <= value)
              elif key == u'$lte':
                  conditions = (
                      Q(q, prev_key) <= value
                  ) if not conditions and prev_key != "$not" \
                  else (conditions & (Q(q, prev_key) <= value)) if prev_key != "$not" \
                  else (q[last_prev_key] > value)
              elif key == u'$lt':
                  conditions = (
                      Q(q, prev_key) < value
                  ) if not conditions and prev_key != "$not" \
                  else (conditions & (Q(q, prev_key) < value)) if prev_key != "$not" \
                  else (q[last_prev_key] >= value)
              elif key == u'$ne':
                  conditions = (
                      Q(q, prev_key) != value
                  ) if not conditions and prev_key != "$not" \
                  else (conditions & (Q(q, prev_key) != value))if prev_key != "$not" \
                  else (q[last_prev_key] == value)
              elif key == u'$not':
                  if not isinstance(value, dict) and not isinstance(value, list):
                      conditions = (
                          Q(q, prev_key) != value
                      ) if not conditions and prev_key != "$not" \
                      else (conditions & (Q(q, prev_key) != value)) \
                      if prev_key != "$not" else (q[last_prev_key] >= value)
                  else:
                      # let the value's condition be parsed below
                      pass
              elif key == u'$regex':
                  value = value.replace('\\\\\\', '|||')
                  value = value.replace('\\\\', '|||')
                  regex = value.replace('\\', '')
                  regex = regex.replace('|||', '\\')
                  currCond = (where(prev_key).matches(regex))
                  conditions = currCond if not conditions else (conditions & currCond)
              elif key in ['$and', '$or', '$in', '$all']:
                  pass
              else:
  
  
                  # don't want to use the previous key if this is a secondary key
                  # (fixes multiple item query that includes $ codes)
                  if not isinstance(value, dict) and not isinstance(value, list):
                      conditions = (
                          (Q(q, key) == value) | (Q(q, key).any([value]))
                      ) if not conditions else (conditions & ((Q(q, key) == value) | (Q(q, key).any([value]))))
                      prev_key = key
  
              logger.debug(u'c: {}'.format(conditions))
              if isinstance(value, dict):
                  # yield from self.parse_condition(value, key)
                  for parse_condition in self.parse_condition(value, key, prev_key):
                      yield parse_condition
              elif isinstance(value, list):
                  if key == '$and':
                      grouped_conditions = None
                      for spec in value:
                          for parse_condition in self.parse_condition(spec):
                              grouped_conditions = (
                                  parse_condition
                                  if not grouped_conditions
                                  else grouped_conditions & parse_condition
                              )
                      yield grouped_conditions
                  elif key == '$or':
                      grouped_conditions = None
                      for spec in value:
                          for parse_condition in self.parse_condition(spec):
                              grouped_conditions = (
                                  parse_condition
                                  if not grouped_conditions
                                  else grouped_conditions | parse_condition
                              )
                      yield grouped_conditions
                  elif key == '$in':
                      # use `any` to find with list, before comparing to single string
                      grouped_conditions = Q(q, prev_key).any(value)
                      for val in value:
                          for parse_condition in self.parse_condition({prev_key : val}):
                              grouped_conditions = (
                                  parse_condition
                                  if not grouped_conditions
                                  else grouped_conditions | parse_condition
                              )
                      yield grouped_conditions
                  elif key == '$all':
                      yield Q(q, prev_key).all(value)
                  else:
                      yield Q(q, prev_key).any([value])
              else:
                  yield conditions