def parse_host_address(addr):
if addr.startswith('<STR_LIT:[>') and addr.endswith('<STR_LIT:]>'):<EOL><INDENT>addr = addr[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL><DEDENT>parts = addr.split('<STR_LIT:/>')<EOL>if len(parts) == <NUM_LIT:1>:<EOL><INDENT>return parts[<NUM_LIT:0>], None, None<EOL><DEDENT>if len(parts) > <NUM_LIT:2>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>domain_or_ip, prefix = parts<EOL>prefix = int(prefix)<EOL>if re.match(r"<STR_LIT>", domain_or_ip):<EOL><INDENT>return domain_or_ip, prefix, ipv4_prefix_to_mask(prefix)<EOL><DEDENT>elif '<STR_LIT::>' in domain_or_ip:<EOL><INDENT>return domain_or_ip, prefix, ipv6_prefix_to_mask(prefix)<EOL><DEDENT>else:<EOL><INDENT>return domain_or_ip, None, None<EOL><DEDENT><DEDENT>
parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address

:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
         cidr prefix if there is,
         net mask code string if there is
:rtype: (string, int, string)