code: def read_sections(self, sections_file, get_goids_only, exclude_ungrouped):
          
          ext = os.path.splitext(sections_file)[1]
          file_contents = None
          if ext == '.py':
              file_contents = self.read_py(sections_file, get_goids_only, exclude_ungrouped)
          else:
              file_contents = self.read_txt(sections_file, get_goids_only, exclude_ungrouped)
          if file_contents:
              return file_contents.get('sections', None)
docs: Read sections variable from a text file of from a Python file.