Tests whether fqa is a fully-qualified subdomain name
    @fqa must be a string
    If it isn't, returns False, None, None.
    If it is, returns True and a tuple (subdomain_name, domain)

    >>> is_address_subdomain('abc')
    (False, None, None)
    >>> is_address_subdomain('abc.def')
    (False, None, None)
    >>> is_address_subdomain('abc.def.ghi')
    (True, 'abc', 'def.ghi')
    >>> is_address_subdomain('abc.def.ghi.jkl')
    (False, None, None)
    >>> is_address_subdomain('Abc.def.ghi')
    (False, None, None)
    >>> is_address_subdomain('abc.Def.ghi')
    (False, None, None)
    >>> is_address_subdomain('abc.def.g+hi')
    (False, None, None)
    >>> is_address_subdomain('..')
    (False, None, None)

def is_address_subdomain(fqa):
    """
    Tests whether fqa is a fully-qualified subdomain name
    @fqa must be a string
    If it isn't, returns False, None, None.
    If it is, returns True and a tuple (subdomain_name, domain)

    >>> is_address_subdomain('abc')
    (False, None, None)
    >>> is_address_subdomain('abc.def')
    (False, None, None)
    >>> is_address_subdomain('abc.def.ghi')
    (True, 'abc', 'def.ghi')
    >>> is_address_subdomain('abc.def.ghi.jkl')
    (False, None, None)
    >>> is_address_subdomain('Abc.def.ghi')
    (False, None, None)
    >>> is_address_subdomain('abc.Def.ghi')
    (False, None, None)
    >>> is_address_subdomain('abc.def.g+hi')
    (False, None, None)
    >>> is_address_subdomain('..')
    (False, None, None)
    """
    # do these checks early to avoid pathological names that make re.match take forever
    if fqa.count(".") != 2:
        return False, None, None

    grp = re.match(OP_SUBDOMAIN_NAME_PATTERN, fqa)
    if grp is None:
        return False, None, None

    subdomain_name, domain = grp.groups()
    if not is_name_valid(domain):
        return False, None, None

    return True, subdomain_name, domain