Strip unnecessary message about running the command with --scope from
    stderr so that we can raise an exception with the remaining stderr text.

def _strip_scope(msg):
    '''
    Strip unnecessary message about running the command with --scope from
    stderr so that we can raise an exception with the remaining stderr text.
    '''
    ret = []
    for line in msg.splitlines():
        if not line.endswith('.scope'):
            ret.append(line)
    return '\n'.join(ret).strip()