def read_sections(self, sections_file, get_goids_only, exclude_ungrouped):
        """Read sections variable from a text file of from a Python file."""
        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)
Read sections variable from a text file of from a Python file.