Uti and sex

Can you have sex when you have a uti? Is it ok or do you need to avoid it until you are clear completely