def get_domain_from_fqdn(name):
    """
    Parses out the domain part that is necessary for getting the hosted zone.
    Accounts for the public suffixes supported by the route53 registrar
    (which is not the complete list. For that, see https://publicsuffix.org/)
    'foo.bar.co.uk.' -> 'bar.co.uk'
    """
    normalized_name = name[:-1] if name.endswith('.') else name
    double_tlds = [
        'com.au',
        'co.uk',
        'com.mx',
        'me.uk',
        'net.au',
        'net.nz',
        'org.nz',
        'org.uk'
    ]
    double_tld = any(map(lambda x: normalized_name.endswith(x), double_tlds))
    split_point = 3 if double_tld else 2
    domain = '.'.join(normalized_name.split('.')[-split_point:])
    return domain