code: def find_cell_end(self, lines):
          
          if self.metadata is None and not (self.cell_marker_end and self.end_code_re.match(lines[0])) \
                  and paragraph_is_fully_commented(lines, self.comment, self.default_language):
              self.cell_type = 'markdown'
              for i, line in enumerate(lines):
                  if _BLANK_LINE.match(line):
                      return i, i + 1, False
              return len(lines), len(lines), False
  
          if self.metadata is None:
              self.end_code_re = None
          elif not self.cell_marker_end:
              end_of_cell = self.metadata.get('endofcell', '-')
              self.end_code_re = re.compile('^' + self.comment + ' ' + end_of_cell + r'\s*$')
  
          return self.find_region_end(lines)
docs: Return position of end of cell marker, and position of first line after cell