docs: def get_reference_lines(docbody,
                          ref_sect_start_line,
                          ref_sect_end_line,
                          ref_sect_title,
                          ref_line_marker_ptn,
                          title_marker_same_line):
      """After the reference section of a document has been identified, and the
         first and last lines of the reference section have been recorded, this
         function is called to take the reference lines out of the document body.
         The document's reference lines are returned in a list of strings whereby
         each string is a reference line. Before this can be done however, the
         reference section is passed to another function that rebuilds any broken
         reference lines.
         @param docbody: (list) of strings - the entire document body.
         @param ref_sect_start_line: (integer) - the index in docbody of the first
          reference line.
         @param ref_sect_end_line: (integer) - the index in docbody of the last
          reference line.
         @param ref_sect_title: (string) - the title of the reference section
          (e.g. "References").
         @param ref_line_marker_ptn: (string) - the patern used to match the
          marker for each reference line (e.g., could be used to match lines
          with markers of the form [1], [2], etc.)
         @param title_marker_same_line: (integer) - a flag to indicate whether
          or not the reference section title was on the same line as the first
          reference line's marker.
         @return: (list) of strings. Each string is a reference line, extracted
          from the document.
      """
      start_idx = ref_sect_start_line
      if title_marker_same_line:
          # Title on same line as 1st ref- take title out!
          title_start = docbody[start_idx].find(ref_sect_title)
          if title_start != -1:
              # Set the first line with no title
              docbody[start_idx] = docbody[start_idx][title_start +
                                                      len(ref_sect_title):]
      elif ref_sect_title is not None:
          # Set the start of the reference section to be after the title line
          start_idx += 1
  
      if ref_sect_end_line is not None:
          ref_lines = docbody[start_idx:ref_sect_end_line + 1]
      else:
          ref_lines = docbody[start_idx:]
  
      if ref_sect_title:
          ref_lines = strip_footer(ref_lines, ref_sect_title)
      # Now rebuild reference lines:
      # (Go through each raw reference line, and format them into a set
      # of properly ordered lines based on markers)
      return rebuild_reference_lines(ref_lines, ref_line_marker_ptn)