The reverse operation of security_to_str.
Security type is used all over the place, so move it out to a more common place.