from typing import Sequence
from typing import Any
from typing import Optional


def rindex(items: Sequence[Any], needle: Any) -> Optional[int]:
    """
    Args:
        items (sequence): The items to search
        needle (object): The object to search for

    Returns:
        The rightmost index of `needle`, or `None`.
    """
    for idx, item in enumerate(reversed(items)):
        if item == needle:
            return len(items) - idx - 1
    return None