def _build_resolver(cls, session: AppSession):
        '''Build resolver.'''
        args = session.args
        dns_timeout = args.dns_timeout

        if args.timeout:
            dns_timeout = args.timeout

        if args.inet_family == 'IPv4':
            family = IPFamilyPreference.ipv4_only
        elif args.inet_family == 'IPv6':
            family = IPFamilyPreference.ipv6_only
        elif args.prefer_family == 'IPv6':
            family = IPFamilyPreference.prefer_ipv6
        elif args.prefer_family == 'IPv4':
            family = IPFamilyPreference.prefer_ipv4
        else:
            family = IPFamilyPreference.any

        return session.factory.new(
            'Resolver',
            family=family,
            timeout=dns_timeout,
            rotate=args.rotate_dns,
            cache=session.factory.class_map['Resolver'].new_cache() if args.dns_cache else None,
        )
Build resolver.