def psutil_wrapper(self, process, method, accessors, try_sudo, *args, **kwargs):
        """
        A psutil wrapper that is calling
        * psutil.method(*args, **kwargs) and returns the result
        OR
        * psutil.method(*args, **kwargs).accessor[i] for each accessors
        given in a list, the result being indexed in a dictionary
        by the accessor name
        """

        if accessors is None:
            result = None
        else:
            result = {}

        # Ban certain method that we know fail
        if method == 'num_fds' and not Platform.is_unix():
            return result
        elif method == 'num_handles' and not Platform.is_win32():
            return result

        try:
            res = getattr(process, method)(*args, **kwargs)
            if accessors is None:
                result = res
            else:
                for acc in accessors:
                    try:
                        result[acc] = getattr(res, acc)
                    except AttributeError:
                        self.log.debug("psutil.{}().{} attribute does not exist".format(method, acc))
        except (NotImplementedError, AttributeError):
            self.log.debug("psutil method {} not implemented".format(method))
        except psutil.AccessDenied:
            self.log.debug("psutil was denied access for method {}".format(method))
            if method == 'num_fds' and Platform.is_unix() and try_sudo:
                try:
                    # It is up the agent's packager to grant
                    # corresponding sudo policy on unix platforms
                    ls_args = ['sudo', 'ls', '/proc/{}/fd/'.format(process.pid)]
                    process_ls = subprocess.check_output(ls_args)
                    result = len(process_ls.splitlines())

                except subprocess.CalledProcessError as e:
                    self.log.exception(
                        "trying to retrieve {} with sudo failed with return code {}".format(method, e.returncode)
                    )
                except Exception:
                    self.log.exception("trying to retrieve {} with sudo also failed".format(method))
        except psutil.NoSuchProcess:
            self.warning("Process {} disappeared while scanning".format(process.pid))

        return result
A psutil wrapper that is calling
        * psutil.method(*args, **kwargs) and returns the result
        OR
        * psutil.method(*args, **kwargs).accessor[i] for each accessors
        given in a list, the result being indexed in a dictionary
        by the accessor name