def calculated_stat(base_stat, level, iv, effort, nature=None):
    """Returns the calculated stat -- i.e. the value actually shown in the game
    on a Pokémon's status tab.
    """

    # Remember: this is from C; use floor division!
    stat = (base_stat * 2 + iv + effort // 4) * level // 100 + 5

    if nature:
        stat = int(stat * nature)

    return stat