code: def _run(method, cmd, cwd=None, shell=True, universal_newlines=True,
               stderr=STDOUT):
          
          if not cmd:
              error_msg = 'Passed empty text or list'
              raise AttributeError(error_msg)
          if isinstance(cmd, six.string_types):
              cmd = str(cmd)
          if shell:
              if isinstance(cmd, list):
                  cmd = ' '.join(cmd)
          else:
              if isinstance(cmd, str):
                  cmd = cmd.strip().split()
          out = method(cmd, shell=shell, cwd=cwd, stderr=stderr,
                       universal_newlines=universal_newlines)
          if isinstance(out, bytes):
              out = out.decode('utf-8')
          return str(out).strip()
docs: Internal wrapper for `call` amd `check_output`