def METHOD_NAME(self, cmd):
    """Insert interpreter if needed.
    It inserts the python exe into the command if cmd[0] ends in .py or caller
    specified run_under.
    We cannot rely on the system to interpret shebang lines for us on
    Windows, so add the python executable to the command if this is a .py
    script.
    """
    if cmd[0].endswith('.py'):
        cmd = [sys.executable] + cmd
    if self.run_under:
        if isinstance(self.run_under, list):
            cmd = self.run_under + cmd
        else:
            cmd = shlex.split(self.run_under) + cmd
    return cmd