<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self):
 """Custom execution for chapel module directive. This class is instantiated by the directive implementation and then this method is called. It parses the options on the module directive, updates the environment according, and creates an index entry for the module. Based on the python domain module directive. """

        env = self.state.document.settings.env
        modname = self.arguments[0].strip()
        noindex = 'noindex' in self.options
        env.temp_data['chpl:module'] = modname
        ret = []
        if not noindex:
            env.domaindata['chpl']['modules'][modname] = \
                (env.docname, self.options.get('synopsis', ''),
                 self.options.get('platform', ''),
                 'deprecated' in self.options)

            # Make a duplicate entry in 'objects' to facilitate searching for
            # the module in ChapelDomain.find_obj().
            env.domaindata['chpl']['objects'][modname] = (
                env.docname, 'module')
            targetnode = nodes.target('', '', ids=['module-' + modname],
                                      ismod=True)
            self.state.document.note_explicit_target(targetnode)

            # The platform and synopsis are not printed. In fact, they are only
            # used in the modindex currently.
            ret.append(targetnode)
            indextext = _('%s (module)') % modname
            inode = addnodes.index(entries=[('single', indextext,
                                             'module-' + modname, '')])
            ret.append(inode)
        return ret