<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sh(self, cmd, ignore_error=False, cwd=None, shell=False, **kwargs):
 """ Run a command with the current working directory set to self.fpath Args: cmd (str or tuple):
 cmdstring or listlike Keyword Arguments: ignore_error (bool):
 if False, raise an Exception if p.returncode is not 0 cwd (str):
 current working dir to run cmd with shell (bool):
 subprocess.Popen ``shell`` kwarg Returns: str: stdout output of wrapped call to ``sh`` (``subprocess.Popen``) """

        kwargs.update({
            'shell': shell,
            'cwd': cwd or self.fpath,
            'stderr': subprocess.STDOUT,
            'stdout': subprocess.PIPE,
            'ignore_error': ignore_error})
        log.debug((('cmd', cmd), ('kwargs', kwargs)))
        return sh(cmd, **kwargs)