import requests


def get_tv_episode_detail(key, id, season, episode, language="en-US"):
    """
    function get_tv_episode_detail
    Get the TV episode details by id.
    inputs:  key         - TMDB API key.
             id          - id of the movie
             season      - Season of the tv series (INT)
             episode     - Episode number of the series (INT)
             language    - send in variable 'loc' which is set at runtime - defaults to 'en-US'
    returns: status_code - HTTP - Status code - 200 is success anything else is considered an error
             jdata       - A JSON data structure containing information on the tv series.
    """
    url = f"https://api.themoviedb.org/3/tv/{id}/season/{season}/episode/{episode}?api_key={key}&language={language}"
    resp = requests.get(url)
    print(f"StatusCode: {resp.status_code}")
    if resp.status_code == 200:
        jdata = resp.json()
    else:
        jdata = None
    return resp.status_code, jdata