code: def do_draw(self, data):
      # 1 - Select a valid top-level domain (TLD) name
      # 2 - Check that the number of characters in our selected TLD won't
      # prevent us from generating at least a 1 character subdomain.
      # 3 - Randomize the TLD between upper and lower case characters.
      domain = data.draw(
          st.sampled_from(TOP_LEVEL_DOMAINS)
          .filter(lambda tld: len(tld) + 2 <= self.max_length)
          .flatmap(
              lambda tld: st.tuples(
                  *(
                      st.sampled_from([c.lower(), c.upper()])
                      for c in tld
                  )
              ).map("".join)
          )
      )
      # RFC-5890 s2.3.1 says such labels are reserved, and since we don't
      # want to bother with xn-- punycode labels we'll exclude them all.
      elem_st = st.from_regex(self.label_regex, fullmatch=True).filter(
          lambda label: len(label) < 4 or label[2:4] != "--"
      )
      # The maximum possible number of subdomains is 126,
      # 1 character subdomain + 1 '.' character, * 126 = 252,
      # with a max of 255, that leaves 3 characters for a TLD.
      # Allowing any more subdomains would not leave enough
      # characters for even the shortest possible TLDs.
      elements = cu.many(data, min_size=1, average_size=3, max_size=126)
      while elements.more():
          # Generate a new valid subdomain using the regex strategy.
          sub_domain = data.draw(elem_st)
          if len(domain) + len(sub_domain) >= self.max_length:
              data.stop_example(discard=True)
              break
          domain = sub_domain + "." + domain
      return domain
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/provisional.py
imports: import string
  from importlib import resources
  from hypothesis import strategies
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.conjecture import utils
  from hypothesis.strategies._internal.utils import defines_strategy
label_desc: Use image node_id 3 for calling the DomainNameStrategy obj's underlying member method code with example usage: obj.do_draw(data) and returns: domain