def generate_session(public, private, modulus):
    """Calculates the session key given the received public key, the receiver's
    private key, and the modulus"""
    return pow(public, private, modulus)