sleeping with best friend

Is it ever ok to sleep with a friend’s ex?

Is it ever ok to sleep with a friend's ex? What about your bestfriend's ex? Are there separate rules? The unsaid code…