def protocol_to_type(protocol): try: protocols = ProtocolsType() setattr(protocols, protocol, True) return protocols except AttributeError: raise VcaError("The value in protocol is not valid")
def _create_protocols_type(self, protocol): all_protocols = {"Tcp": None, "Udp": None, "Icmp": None, "Any": None} all_protocols[protocol] = True return ProtocolsType(**all_protocols)