def estimate_shots_per_poss(
    shots_per_opp, three_attempt_rate, three_make_rate, two_make_rate, off_reb_rate
):
    """
    Estimates shot attempts per possession given shot attempts per opportunity,
    (see above for definition), then taking into account how frequently shots are missed
    and rebounded by the offense.
    """
    no_shots_per_opp = 1 - shots_per_opp
    make_rate = (
        three_attempt_rate * three_make_rate + (1 - three_attempt_rate) * two_make_rate
    )
    miss_rate = 1 - make_rate
    def_reb_rate = 1 - off_reb_rate

    restart_possession = shots_per_opp * miss_rate * off_reb_rate
    last_shot = shots_per_opp * (
        make_rate + miss_rate * (def_reb_rate + off_reb_rate * no_shots_per_opp)
    )
    return last_shot / (1 - restart_possession) ** 2