How to make this shape? Im a bit stumped how to do it elegantly

Its the 2 open ends that are stumping me. Ignore all the detail and the one in the centre. I just need to know how to make the basic shape. Hopefuly without having to trim the circular ends, although mirroring over half of it is fine.

Thank you.

Hi Simon - - this looks a lot like a sort of special case of the situation discussed at length here