def parseFile(self, file=None):
        """
        Parse a configuration file

        If file is None and self.defaultFilename is set, it will open
        defaultFilename and use it.
        """
        close = False
        if file is None and self.defaultFilename:
            file = open(self.defaultFilename,'r')
            close = True

        try:
            for line in file.readlines():
                # Strip out comments
                comment = line.find(self.commentChar)
                if comment != -1:
                    line = line[:comment]

                # Strip whitespace
                line = line.strip()

                # Skip empty lines (and lines which only contain comments)
                if not line:
                    continue

                self.parseLine(line)
        finally:
            if close:
                file.close()

        Parse a configuration file

        If file is None and self.defaultFilename is set, it will open
        defaultFilename and use it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/inetdconf.py