def get_ranked_stats(summoner, season=None):
    if season and season not in cassiopeia.type.core.common.stats_seasons:
        raise ValueError("Must use a valid season to get ranked stats for")

    stats = cassiopeia.dto.statsapi.get_ranked_stats(summoner.id, season.value if season else None)
    champions = {champion.id: champion for champion in cassiopeia.riotapi.get_champions_by_id(list(stats.champion_ids))}
    champions[0] = None

    return {champions[stat.id]: cassiopeia.type.core.stats.AggregatedStats(stat.stats) for stat in stats.champions}
Gets a summoner's ranked stats
dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/core/statsapi.py/get_ranked_stats