docs: def get_link_density(node, node_text=None):
      """
      Computes the ratio for text in given node and text in links
      contained in the node. It is computed from number of
      characters in the texts.
  
      :parameter Element node:
          HTML element in which links density is computed.
      :parameter string node_text:
          Text content of given node if it was obtained before.
      :returns float:
          Returns value of computed 0 <= density <= 1, where 0 means
          no links and 1 means that node contains only links.
      """
      if node_text is None:
          node_text = node.text_content()
      node_text = normalize_whitespace(node_text.strip())
  
      text_length = len(node_text)
      if text_length == 0:
          return 0.0
  
      links_length = sum(map(_get_normalized_text_length, node.findall(".//a")))
      # Give 50 bonus chars worth of length for each img.
      # Tweaking this 50 down a notch should help if we hit false positives.
      img_bonuses = 50 * len(node.findall(".//img"))
      links_length = max(0, links_length - img_bonuses)
  
      return links_length / text_length