def METHOD_NAME(self, _legacy_inactive_history_style, active_history):
    Port, port, jack, Jack = (
        self.classes.Port,
        self.tables.port,
        self.tables.jack,
        self.classes.Jack,
    )
    self.mapper_registry.map_imperatively(Port, port)
    self.mapper_registry.map_imperatively(
        Jack,
        jack,
        properties=dict(
            port=relationship(
                Port,
                backref="jack",
                uselist=False,
                active_history=active_history,
                _legacy_inactive_history_style=(
                    _legacy_inactive_history_style
                ),
            )
        ),
    )
    session = fixture_session()
    j = Jack(number="101")
    session.add(j)
    p = Port(name="fa0/1")
    session.add(p)
    j.port = p
    session.flush()
    jid = j.id
    pid = p.id
    j = session.get(Jack, jid)
    p = session.get(Port, pid)
    assert p.jack is not None
    assert p.jack is j
    assert j.port is not None
    p.jack = None
    assert j.port is None
    session.expunge_all()
    j = session.get(Jack, jid)
    p = session.get(Port, pid)
    j.port = None
    if not active_history and not _legacy_inactive_history_style:
        session.flush()
        self.assert_(p.jack is None)
    else:
        self.assert_(p.jack is None)
        session.flush()
    session.delete(j)
    session.flush()