<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def af_for_address(text):
 """Determine the address family of a textual-form network address. @param text: the textual address @type text: string @raises ValueError: the address family cannot be determined from the input. @rtype: int """

    try:
        junk = dns.ipv4.inet_aton(text)
        return AF_INET
    except Exception:
        try:
            junk = dns.ipv6.inet_aton(text)
            return AF_INET6
        except Exception:
            raise ValueError