'Get the error code and message from a JSON response.
Return just the first error if there are multiple errors.
:param  body: The body of the JSON response dictionary
:type   body: ``dict``
:return:  Tuple containing error code and message
:rtype:   ``tuple`` of ``str`` or ``int``'

def _get_error(self, body):

    if ('errors' in body['error']):
        err = body['error']['errors'][0]
    else:
        err = body['error']
    if ('code' in err):
        code = err.get('code')
        message = err.get('message')
    else:
        code = None
        if ('reason' in err):
            code = err.get('reason')
        message = body.get('error_description', err)
    return (code, message)
