docs: def _parse_tags(tag_file):
      """Parses a tag file, according to RFC 2822.  This
         includes line folding, permitting extra-long
         field values.
  
         See http://www.faqs.org/rfcs/rfc2822.html for
         more information.
      """
  
      tag_name = None
      tag_value = None
  
      # Line folding is handled by yielding values only after we encounter
      # the start of a new tag, or if we pass the EOF.
      for num, line in enumerate(tag_file):
          # If byte-order mark ignore it for now.
          if num == 0:
              if line.startswith(BOM):
                  line = line.lstrip(BOM)
          # Skip over any empty or blank lines.
          if len(line) == 0 or line.isspace():
              continue
          elif line[0].isspace() and tag_value is not None:  # folded line
              tag_value += line
          else:
              # Starting a new tag; yield the last one.
              if tag_name:
                  yield (tag_name, tag_value.strip())
  
              if ':' not in line:
                  raise BagValidationError("invalid line '%s' in %s" % (line.strip(),
                                                                        os.path.basename(tag_file.name)))
  
              parts = line.strip().split(':', 1)
              tag_name = parts[0].strip()
              tag_value = parts[1]
  
      # Passed the EOF.  All done after this.
      if tag_name:
          yield (tag_name, tag_value.strip())