def check_response(response: urllib3.response.HTTPResponse, member_name: str,
                   action_name: str, silent_success: bool = False) -> bool:
    """Check an HTTP response and print a status message.

    :param response: the response to be checked.
    :param member_name: name of the member associated with the *response*.
    :param action_name: action associated with the *response*.
    :param silent_success: if a status message should be skipped upon a successful *response*.

    :returns: ``True`` if the response indicates a successful operation (HTTP status < ``400``), ``False`` otherwise.
    """
    if response.status >= 400:
        click.echo('Failed: {0} for member {1}, status code={2}, ({3})'.format(
            action_name, member_name, response.status, response.data.decode('utf-8')
        ))
        return False
    elif not silent_success:
        click.echo('Success: {0} for member {1}'.format(action_name, member_name))
    return True
Check an HTTP response and print a status message.

    :param response: the response to be checked.
    :param member_name: name of the member associated with the *response*.
    :param action_name: action associated with the *response*.
    :param silent_success: if a status message should be skipped upon a successful *response*.

    :returns: ``True`` if the response indicates a successful operation (HTTP status < ``400``), ``False`` otherwise.
    
patroni/ctl.py