parameters: (lines, markers)
return_statement: return slice(start, end)
docstring: Find a section defined by an initial start marker, an optional secondary
      marker and an end marker.
      The section is between the secondary/initial start and the end.
      Report as a slice object so the section can be extracted or replaced.
      Raises an exception if the markers can't be found.
docstring_summary: Find a section defined by an initial start marker, an optional secondary
      marker and an end marker.
      The section is between the secondary/initial start and the end.
      Report as a slice object so the section can be extracted or replaced.
      Raises an exception if the markers can't be found.
docstring_tokens: Find a section defined by an initial start marker an optional secondary marker and an end marker . The section is between the secondary / initial start and the end . Report as a slice object so the section can be extracted or replaced . Raises an exception if the markers can t be found .
function: def FindSectionInList(lines, markers):
      """Find a section defined by an initial start marker, an optional secondary
      marker and an end marker.
      The section is between the secondary/initial start and the end.
      Report as a slice object so the section can be extracted or replaced.
      Raises an exception if the markers can't be found.
      """
      start = -1
      end = -1
      state = 0
      for i, l in enumerate(lines):
          if markers[0] in l:
              if markers[1]:
                  state = 1
              else:
                  start = i+1
                  state = 2
          elif state == 1:
              if markers[1] in l:
                  start = i+1
                  state = 2
          elif state == 2:
              if markers[2] in l:
                  end = i
                  state = 3
      # Check that section was found
      if start == -1:
          raise Exception("Could not find start marker(s) |" + markers[0] + "|" + markers[1] + "|")
      if end == -1:
          raise Exception("Could not find end marker " + markers[2])
      return slice(start, end)
function_tokens: def FindSectionInList ( lines , markers ) : start = - 1 end = - 1 state = 0 for i , l in enumerate ( lines ) : if markers [ 0 ] in l : if markers [ 1 ] : state = 1 else : start = i + 1 state = 2 elif state == 1 : if markers [ 1 ] in l : start = i + 1 state = 2 elif state == 2 : if markers [ 2 ] in l : end = i state = 3 # Check that section was found if start == - 1 : raise Exception ( "Could not find start marker(s) |" + markers [ 0 ] + "|" + markers [ 1 ] + "|" ) if end == - 1 : raise Exception ( "Could not find end marker " + markers [ 2 ] ) return slice ( start , end )