def METHOD_NAME(self, address_family_preference=None):
    """
    Returns true if the host has dual stack support and can optionally check 
    the provided IP family preference.
    """
    dual_stack = not self.has_ipv6_only() and not self.has_ipv4_only()
    if address_family_preference:
        address = self.get_addresses()[0]
        return dual_stack and address[0] == address_family_preference
    return dual_stack