def _list_at_index_or_none(ls, idx):
    """Return the element of a list at the given index if it exists, return None otherwise.

    Args:
        ls (list[object]): The target list
        idx (int): The target index

    Returns:
        Union[object,NoneType]: The element at the target index or None
    """
    if len(ls) > idx:
        return ls[idx]

    return None