def __getitem__(self, item):
    if isinstance(item, slice):
        q = self
        start = (item.start or 0)
        stop = item.stop
        step = item.step
        if (step is not None):
            raise SupportError('Cannot support step in __getitem__ now!')
        if start:
            q = q.offset(start)
        if ((stop is not None) and (start or (stop != sys.maxsize))):
            q = q.limit((stop - start))
        return q.all()
    field = self._model_class.get_singleness_pk_field()
    return self.filter((field == item)).first()
def __getitem__(self, item):
    if isinstance(item, slice):
        q = self
        start = (item.start or 0)
        stop = item.stop
        step = item.step
        if (step is not None):
            raise SupportError('Cannot support step in __getitem__ now!')
        if start:
            q = q.offset(start)
        if ((stop is not None) and (start or (stop != sys.maxsize))):
            q = q.limit((stop - start))
        return q.all()
    field = self._model_class.get_singleness_pk_field()
    return self.filter((field == item)).first()