code: def strip_headers(text):
      
      lines = text.splitlines()
      sep = str(os.linesep)
  
      out = []
      i = 0
      footer_found = False
      ignore_section = False
  
      for line in lines:
          reset = False
  
          if i <= 600:
              # Check if the header ends here
              if any(line.startswith(token) for token in TEXT_START_MARKERS):
                  reset = True
  
              # If it's the end of the header, delete the output produced so far.
              # May be done several times, if multiple lines occur indicating the
              # end of the header
              if reset:
                  out = []
                  continue
  
          if i >= 100:
              # Check if the footer begins here
              if any(line.startswith(token) for token in TEXT_END_MARKERS):
                  footer_found = True
  
              # If it's the beginning of the footer, stop output
              if footer_found:
                  break
  
          if any(line.startswith(token) for token in LEGALESE_START_MARKERS):
              ignore_section = True
              continue
          elif any(line.startswith(token) for token in LEGALESE_END_MARKERS):
              ignore_section = False
              continue
  
          if not ignore_section:
              out.append(line.rstrip(sep))
              i += 1
  
      return sep.join(out)
docs: Remove lines that are part of the Project Gutenberg header or footer.
      Note: this function is a port of the C++ utility by Johannes Krugel. The
      original version of the code can be found at:
      http://www14.in.tum.de/spp1307/src/strip_headers.cpp
  
      Args:
          text (unicode): The body of the text to clean up.
  
      Returns:
          unicode: The text with any non-text content removed.