docs: def wash_and_repair_reference_line(line):
      """Wash a reference line of undesirable characters (such as poorly-encoded
         letters, etc), and repair any errors (such as broken URLs) if possible.
         @param line: (string) the reference line to be washed/repaired.
         @return: (string) the washed reference line.
      """
      # repair URLs in line:
      line = repair_broken_urls(line)
      # Replace various undesirable characters with their alternatives:
      line = replace_undesirable_characters(line)
      # Replace "<title>," with "<title>",
      # common typing mistake
      line = re.sub(ur'"([^"]+),"', ur'"\g<1>",', line)
      line = replace_undesirable_characters(line)
      # Remove instances of multiple spaces from line, replacing with a
      # single space:
      line = re_multiple_space.sub(u' ', line)
      return line