'Gets the error message from a JSON response.
code: 400
error: \'Bad request\''

@staticmethod
def _get_error_message(response):

    error_message = 'Unknown    error'
    try:
        error_json = response.json()
        if ('error' in error_json):
            if (isinstance(error_json['error'], dict) and ('description' in error_json['error'])):
                error_message = ('Error:    ' + error_json['error']['description'])
            else:
                error_message = ('Error:    ' + error_json['error'])
        elif ('error_message' in error_json):
            error_message = ('Error:    ' + error_json['error_message'])
        elif ('msg' in error_json):
            error_message = ('Error:    ' + error_json['msg'])
        elif ('statusInfo' in error_json):
            error_message = ('Error:    ' + error_json['statusInfo'])
        if ('description' in error_json):
            error_message += (',    Description:    ' + error_json['description'])
        error_message += (',    Code:    ' + str(response.status_code))
        return error_message
    except:
        return {'error': (response.text or error_message), 'code': str(response.status_code)}
