code: def _predicate(self, i):
          
          if isinstance(i, slice):
              if i.step is not None:
                  raise TypeError("Slice step not permitted")
              if ( (i.start is not None and not isinstance(i.start, datetime))
                  or (i.stop is not None and not isinstance(i.stop, datetime))
              ):
                  raise TypeError(
                      "Slice indices must be {} or None".format(datetime)
                  )
              if i.start is not None and i.stop is not None:
                  if i.start > i.stop:
                      raise ValueError(
                          "Start index is greater than the End index"
                      )
                  else:
                      # Substitution of the key coloumn, but the
                      # parameters themselves will be substituted by sqlite3
                      predicate = "WHERE {} BETWEEN :start AND :stop".format(
                          self._keycol
                      )
              elif i.start is not None:
                  # i.stop will also be None
                  predicate = "WHERE {} >= :start".format(self._keycol)
              elif i.stop is not None:
                  # i.start will also be None
                  predicate = "WHERE {} <= :stop".format(self._keycol)
              else:
                  # both are None, so equivelent to wanting everything
                  predicate = ""
              multi = True
              pred = {"start": i.start, "stop": i.stop}
          elif isinstance(i, datetime):
              # Substitution of the key coloumn, but the
              # parameters themselves will be substituted by sqlite3
              predicate = "WHERE {} = :key".format(self._keycol)
              multi = False
              pred = {"key": i}
          else:
              # not a slice or a datetime object
              raise TypeError("List indices must be {}".format(datetime))
          # predicate is the end of the query string.
          # multi is a boolean indicating whether the result should be iterable
          # or not. pred is a dict of the parameters for substitution
          return (predicate, multi, pred)
docs: Given a valid datetime or slace, return the predicate portion
          of the SQL query, a boolean indicating whether multiple items are
          expected from the result, and a dictionary of parameters for the query