def rstrip(self, chars=None):
        """Removes whitespace characters from the end of this expression, which
        must resolve to a string.

        If ``chars`` is provided, those characters are removed instead of
        whitespace.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            dataset = foz.load_zoo_dataset("quickstart")

            # Adds and then strips whitespace from the end of each tag
            transform_tag = F().concat(" ").rstrip()
            view = dataset.set_field("tags", F("tags").map(transform_tag))

            print(dataset.distinct("tags"))
            print(view.distinct("tags"))

        Args:
            chars (None): an optional string or :class:`ViewExpression`
                resolving to a string expression specifying characters to
                remove

        Returns:
            a :class:`ViewExpression`
        """
        rtrim = {"input": self}
        if chars is not None:
            rtrim["chars"] = chars

        return ViewExpression({"$rtrim": rtrim})
Removes whitespace characters from the end of this expression, which
        must resolve to a string.

        If ``chars`` is provided, those characters are removed instead of
        whitespace.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            dataset = foz.load_zoo_dataset("quickstart")

            # Adds and then strips whitespace from the end of each tag
            transform_tag = F().concat(" ").rstrip()
            view = dataset.set_field("tags", F("tags").map(transform_tag))

            print(dataset.distinct("tags"))
            print(view.distinct("tags"))

        Args:
            chars (None): an optional string or :class:`ViewExpression`
                resolving to a string expression specifying characters to
                remove

        Returns:
            a :class:`ViewExpression`
        
fiftyone/core/expressions.py