def get_modules(self, name=None, daemon_name=None, names_only=True):
        if name is not None:
            sections = self._search_sections('module.' + name)
            if 'module.' + name in sections:
                return sections['module.' + name]
            return {}
        if daemon_name is not None:
            section = self.get_daemons(daemon_name)
            if 'modules' in section and section['modules']:
                modules = []
                for module_name in section['modules'].split(','):
                    if names_only:
                        modules.append(module_name)
                    else:
                        modules.append(self.get_modules(name=module_name))
                return modules
            return []
        return self._search_sections('module.')