def b1_error_msg(resp):
    """Return error message string based on BloxOne API response."""

    try:
        response = resp.json()  # Responses should be in JSON ...
        if not isinstance(response, dict) or 'text' not in response:
            api_err = resp.text
        else:
            api_err = response['text']
    except ValueError:
        api_err = resp.text  # ... but if they're not
    return api_err