def set_error(scope, error_re=None):
    """
    Defines a pattern that, whenever detected in the response of the remote
    host, causes an error to be raised.

    In other words, whenever Exscript waits for a prompt, it searches the
    response of the host for the given pattern and raises an error if the
    pattern is found.

    :type  error_re: regex
    :param error_re: The error pattern.
    """
    conn = scope.get('__connection__')
    conn.set_error_prompt(error_re)
    return True
Defines a pattern that, whenever detected in the response of the remote
    host, causes an error to be raised.

    In other words, whenever Exscript waits for a prompt, it searches the
    response of the host for the given pattern and raises an error if the
    pattern is found.

    :type  error_re: regex
    :param error_re: The error pattern.