def popen(args, **kwargs):
if "<STR_LIT>" not in kwargs:<EOL><INDENT>try:<EOL><INDENT>file_no = sys.stdin.fileno()<EOL><DEDENT>except AttributeError:<EOL><INDENT>file_no = sys.__stdin__.fileno()<EOL><DEDENT>if file_no not in (<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:2>):<EOL><INDENT>kwargs["<STR_LIT>"] = subprocess.PIPE<EOL><DEDENT><DEDENT>return subprocess.Popen(args, **kwargs)<EOL>
Wrapper for `subprocess.Popen`.

    Avoids python bug described here: https://bugs.python.org/issue3905. This
    can arise when apps (maya) install a non-standard stdin handler.

    In newer version of maya and katana, the sys.stdin object can also become
    replaced by an object with no 'fileno' attribute, this is also taken into
    account.