def METHOD_NAME(cmd, **kwargs):
    """Logs and runs the command, raising on errors."""
    print('Run:', ' '.join(pipes.quote(c) for c in cmd), end=' ', file=sys.stderr)
    if hasattr(kwargs.get('stdout'), 'name'):
        print(' > %s' % kwargs['stdout'].name, file=sys.stderr)
    else:
        print()
    # If 'stdin' keyword arg is a string run command and communicate string to stdin
    if 'stdin' in kwargs and isinstance(kwargs['stdin'], str):
        in_string = kwargs['stdin']
        kwargs['stdin'] = subprocess.PIPE
        proc = subprocess.Popen(cmd, **kwargs)
        proc.communicate(input=in_string.encode('utf-8'))
        return
    subprocess.check_call(cmd, **kwargs)