'Parse the HTTP response given a shape.
:param response: The HTTP response dictionary.  This is a dictionary
that represents the HTTP request.  The dictionary must have the
following keys, ``body``, ``headers``, and ``status_code``.
:param shape: The model shape describing the expected output.
:return: Returns a dictionary representing the parsed response
described by the model.  In addition to the shape described from
the model, each response will also have a ``ResponseMetadata``
which contains metadata about the response, which contains at least
two keys containing ``RequestId`` and ``HTTPStatusCode``.  Some
responses may populate additional keys, but ``RequestId`` will
always be present.'

def parse(self, response, shape):

    LOG.debug('Response    headers:    %s', response['headers'])
    LOG.debug('Response    body:\n%s', response['body'])
    if (response['status_code'] >= 301):
        if self._is_generic_error_response(response):
            parsed = self._do_generic_error_parse(response)
        else:
            parsed = self._do_error_parse(response, shape)
    else:
        parsed = self._do_parse(response, shape)
    if isinstance(parsed, dict):
        response_metadata = parsed.get('ResponseMetadata', {})
        response_metadata['HTTPStatusCode'] = response['status_code']
        response_metadata['HTTPHeaders'] = dict(response['headers'])
        parsed['ResponseMetadata'] = response_metadata
    return parsed
