def get_pell(n):
    """
    Calculates the nth Pell number.

    Pell numbers are defined by the recurrence relation:
    P(n) = 2 * P(n-1) + P(n-2)
    with base cases P(0) = 0 and P(1) = 1.

    Args:
        n: A non-negative integer.

    Returns:
        The nth Pell number.
    """
    if n < 0:
        # Pell numbers are not defined for negative indices.
        # Depending on requirements, one might raise an error or return None.
        # For this task, we assume n is non-negative based on typical usage.
        return None

    # Initialize the first two numbers in the sequence, P(0) and P(1)
    pell_current, pell_next = 0, 1

    # Loop n times to advance the sequence to the nth number
    for _ in range(n):
        # The new current number is the old next number.
        # The new next number is calculated using the recurrence relation.
        pell_current, pell_next = pell_next, 2 * pell_next + pell_current

    return pell_current