from typing import Sequence, TypeVar, TYPE_CHECKING

if TYPE_CHECKING:
    from _typeshed import SupportsLessThan

T = TypeVar('T', bound='SupportsLessThan')
def largest(items: Sequence[T]) -> T:
    if len(items) == 0:
        raise ValueError("Cannot get largest item in empty list")

    largest_item = items[0]
    for item in items:
        if item > largest_item:
            largest_item = item

    return largest_item

nums = [16, 3, 42, 7]
print(largest(nums))  # Output: 42