def _where(self, *comparators, **comparator):

        def by_schema(self, schema):

            log = self[:]
            to_remove = set()

            for line in log:

                if not isinstance(line, collections.Mapping):
                    try:
                        d = line.__dict__
                    except __HOLE__:
                        continue
                else:
                    d = line

                for k, t in schema.items():

                    if k.startswith('~'):
                        notted = True
                        k = k[1:]
                    else:
                        notted = False

                    if k not in d:
                        to_remove.add(line)
                    else:

                        v = d[k]

                        if (isinstance(v, collections.Iterable) and
                                not isinstance(v, (str, unicode))):
                            method = self._vector_match
                        else:
                            method = self._scalar_match

                        if notted:
                            if method(v, t):
                                to_remove.add(line)
                        else:
                            if not method(v, t):
                                to_remove.add(line)

            for line in to_remove:
                log.remove(line)

            return log

        log = self.__class__(self)
        if comparator:
            comparators += (comparator,)

        for comparator in comparators:

            if isinstance(comparator, collections.Mapping):
                log = by_schema(log, comparator)
                continue

            if callable(comparator):
                log = self.__class__(
                    [line for line in log if comparator(line)])
                continue

            raise TypeError("Invalid comparator")

        return log
dataset/ETHPy150Open jomido/jogger/jogger/jogger.py/APIMixin._where