Set values to be used for a ``start_at`` or ``end_at`` cursor.

        The values will later be used in a query protobuf.

        When the query is sent to the server, the ``document_fields`` will
        be used in the order given by fields set by
        :meth:`~.firestore_v1beta1.query.Query.order_by`.

        Args:
            document_fields (Union[~.firestore_v1beta1.\
                document.DocumentSnapshot, dict, list, tuple]): a document
                snapshot or a dictionary/list/tuple of fields representing a
                query results cursor. A cursor is a collection of values that
                represent a position in a query result set.
            before (bool): Flag indicating if the document in
                ``document_fields`` should (:data:`False`) or
                shouldn't (:data:`True`) be included in the result set.
            start (Optional[bool]): determines if the cursor is a ``start_at``
                cursor (:data:`True`) or an ``end_at`` cursor (:data:`False`).

        Returns:
            ~.firestore_v1beta1.query.Query: A query with cursor. Acts as
            a copy of the current query, modified with the newly added
            "start at" cursor.

def _cursor_helper(self, document_fields, before, start):
        """Set values to be used for a ``start_at`` or ``end_at`` cursor.

        The values will later be used in a query protobuf.

        When the query is sent to the server, the ``document_fields`` will
        be used in the order given by fields set by
        :meth:`~.firestore_v1beta1.query.Query.order_by`.

        Args:
            document_fields (Union[~.firestore_v1beta1.\
                document.DocumentSnapshot, dict, list, tuple]): a document
                snapshot or a dictionary/list/tuple of fields representing a
                query results cursor. A cursor is a collection of values that
                represent a position in a query result set.
            before (bool): Flag indicating if the document in
                ``document_fields`` should (:data:`False`) or
                shouldn't (:data:`True`) be included in the result set.
            start (Optional[bool]): determines if the cursor is a ``start_at``
                cursor (:data:`True`) or an ``end_at`` cursor (:data:`False`).

        Returns:
            ~.firestore_v1beta1.query.Query: A query with cursor. Acts as
            a copy of the current query, modified with the newly added
            "start at" cursor.
        """
        if isinstance(document_fields, tuple):
            document_fields = list(document_fields)
        elif isinstance(document_fields, document.DocumentSnapshot):
            if document_fields.reference._path[:-1] != self._parent._path:
                raise ValueError(
                    "Cannot use snapshot from another collection as a cursor."
                )
        else:
            # NOTE: We copy so that the caller can't modify after calling.
            document_fields = copy.deepcopy(document_fields)

        cursor_pair = document_fields, before
        query_kwargs = {
            "projection": self._projection,
            "field_filters": self._field_filters,
            "orders": self._orders,
            "limit": self._limit,
            "offset": self._offset,
        }
        if start:
            query_kwargs["start_at"] = cursor_pair
            query_kwargs["end_at"] = self._end_at
        else:
            query_kwargs["start_at"] = self._start_at
            query_kwargs["end_at"] = cursor_pair

        return self.__class__(self._parent, **query_kwargs)