import requests
from bs4 import BeautifulSoup


def advanced_player_soup_grab(last_name_letter, player_id, year):
    """Returns a soup object for Advanced stats for each player in a given year"""
    advanced_season_url = f'https://www.pro-football-reference.com/players/{last_name_letter}/{player_id}/gamelog/{year}/advanced/'
    r_player = requests.get(advanced_season_url)
    soup = BeautifulSoup(r_player.content, 'html.parser')
    return soup