<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _command_template(self, switches, objectInput=None):
 """Template for Tika app commands Args: switches (list):
 list of switches to Tika app Jar objectInput (object):
 file object/standard input to analyze Return: Standard output data (unicode Python 2, str Python 3) """

        command = ["java", "-jar", self.file_jar, "-eUTF-8"]
        if self.memory_allocation:
            command.append("-Xmx{}".format(self.memory_allocation))
        command.extend(switches)

        if not objectInput:
            objectInput = subprocess.PIPE

        log.debug("Subprocess command: {}".format(", ".join(command)))

        if six.PY2:
            with open(os.devnull, "w") as devnull:
                out = subprocess.Popen(
                    command,
                    stdin=objectInput,
                    stdout=subprocess.PIPE,
                    stderr=devnull)

        elif six.PY3:
            out = subprocess.Popen(
                command,
                stdin=objectInput,
                stdout=subprocess.PIPE,
                stderr=subprocess.DEVNULL)

        stdoutdata, _ = out.communicate()
        return stdoutdata.decode("utf-8").strip()