def py_run(command_options="<STR_LIT>", return_std=False, stdout=None, stderr=None):
<EOL>executable = sys.executable if "<STR_LIT>" in sys.executable else "<STR_LIT>"<EOL>epylint_part = [executable, "<STR_LIT:-c>", "<STR_LIT>"]<EOL>options = shlex.split(command_options, posix=not sys.platform.startswith("<STR_LIT>"))<EOL>cli = epylint_part + options<EOL>if stdout is None:<EOL><INDENT>if return_std:<EOL><INDENT>stdout = PIPE<EOL><DEDENT>else:<EOL><INDENT>stdout = sys.stdout<EOL><DEDENT><DEDENT>if stderr is None:<EOL><INDENT>if return_std:<EOL><INDENT>stderr = PIPE<EOL><DEDENT>else:<EOL><INDENT>stderr = sys.stderr<EOL><DEDENT><DEDENT>process = Popen(<EOL>cli,<EOL>shell=False,<EOL>stdout=stdout,<EOL>stderr=stderr,<EOL>env=_get_env(),<EOL>universal_newlines=True,<EOL>)<EOL>proc_stdout, proc_stderr = process.communicate()<EOL>if return_std:<EOL><INDENT>return StringIO(proc_stdout), StringIO(proc_stderr)<EOL><DEDENT>return None<EOL>
Run pylint from python

    ``command_options`` is a string containing ``pylint`` command line options;
    ``return_std`` (boolean) indicates return of created standard output
    and error (see below);
    ``stdout`` and ``stderr`` are 'file-like' objects in which standard output
    could be written.

    Calling agent is responsible for stdout/err management (creation, close).
    Default standard output and error are those from sys,
    or standalone ones (``subprocess.PIPE``) are used
    if they are not set and ``return_std``.

    If ``return_std`` is set to ``True``, this function returns a 2-uple
    containing standard output and error related to created process,
    as follows: ``(stdout, stderr)``.

    To silently run Pylint on a module, and get its standard output and error:
        >>> (pylint_stdout, pylint_stderr) = py_run( 'module_name.py', True)