Generating rec_type string for custom form

I’m using a custom form and need to set the value of rec_type for the event. Is there a function I can call to generate that string? Or do I need to write my own?

There is no built-in function, so you need to write a custom code for it.

Thanks