@internationalizeDocstring
    def fortune(self, irc, msg, args):
        """takes no arguments

        Returns a fortune from the *nix fortune program.
        """
        channel = msg.args[0]
        fortuneCmd = self.registryValue('fortune.command')
        if fortuneCmd:
            args = [fortuneCmd]
            if self.registryValue('fortune.short', channel):
                args.append('-s')
            if self.registryValue('fortune.equal', channel):
                args.append('-e')
            if self.registryValue('fortune.offensive', channel):
                args.append('-a')
            args.extend(self.registryValue('fortune.files', channel))
            try:
                with open(os.devnull) as null:
                    inst = subprocess.Popen(args,
                                            stdout=subprocess.PIPE,
                                            stderr=subprocess.PIPE,
                                            stdin=null)
            except __HOLE__ as e:
                irc.error(_('It seems the configured fortune command was '
                          'not available.'), Raise=True)
            (out, err) = inst.communicate()
            inst.wait()
            if minisix.PY3:
                lines = [i.decode('utf-8').rstrip() for i in out.splitlines()]
                lines = list(map(str, lines))
            else:
                lines = out.splitlines()
                lines = list(map(str.rstrip, lines))
            lines = filter(None, lines)
            irc.replies(lines, joiner=' ')
        else:
            irc.error(_('The fortune command is not configured. If fortune is '
                      'installed on this system, reconfigure the '
                      'supybot.plugins.Unix.fortune.command configuration '
                      'variable appropriately.'))
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Unix/plugin.py/Unix.fortune