code: def scrape(text, ptype=None):
      '''
      Scrape types from a blob of text and return node tuples.
  
      Args:
          text (str): Text to scrape.
          ptype (str): Optional ptype to scrape. If present, only scrape rules which match the provided type.
  
      Returns:
          (str, str): Yield tuples of type, valu strings.
      '''
  
      for ruletype, rule, info in scrape_types:
          if ptype and ptype != ruletype:
              continue
          regx = regexes.get(ruletype)
          for valu in regx.findall(text):
              yield (ruletype, valuf scrape(text, ptype=None):
      '''
      Scrape types from a blob of text and return node tuples.
  
      Args:
          text (str): Text to scrape.
          ptype (str): Optional ptype to scrape. If present, only scrape rules which match the provided type.
  
      Returns:
          (str, str): Yield tuples of type, valu strings.
      '''
  
      for ruletype, rule, info in scrape_types:
          if ptype and ptype != ruletype:
              continue
          regx = regexes.get(ruletype)
          for valu in regx.findall(text):
              yield (ruletype, valu)
docs: Scrape types from a blob of text and return node tuples.
  
      Args:
          text (str): Text to scrape.
          ptype (str): Optional ptype to scrape. If present, only scrape rules which match the provided type.
  
      Returns:
          (str, str): Yield tuples of type, valu strings.