def _decrypt_blob(require_encryption, key_encryption_key, key_resolver,<EOL>response, start_offset, end_offset):
_validate_not_none('<STR_LIT>', response)<EOL>content = response.body<EOL>_validate_not_none('<STR_LIT:content>', content)<EOL>try:<EOL><INDENT>encryption_data = _dict_to_encryption_data(loads(response.headers['<STR_LIT>']))<EOL><DEDENT>except:<EOL><INDENT>if require_encryption:<EOL><INDENT>raise ValueError(_ERROR_DATA_NOT_ENCRYPTED)<EOL><DEDENT>else:<EOL><INDENT>return content<EOL><DEDENT><DEDENT>if not (encryption_data.encryption_agent.encryption_algorithm == _EncryptionAlgorithm.AES_CBC_256):<EOL><INDENT>raise ValueError(_ERROR_UNSUPPORTED_ENCRYPTION_ALGORITHM)<EOL><DEDENT>blob_type = response.headers['<STR_LIT>']<EOL>iv = None<EOL>unpad = False<EOL>start_range, end_range = <NUM_LIT:0>, len(content)<EOL>if '<STR_LIT>' in response.headers:<EOL><INDENT>content_range = response.headers['<STR_LIT>']<EOL>content_range = content_range.split('<STR_LIT:U+0020>')<EOL>content_range = content_range[<NUM_LIT:1>].split('<STR_LIT:->')<EOL>start_range = int(content_range[<NUM_LIT:0>])<EOL>content_range = content_range[<NUM_LIT:1>].split('<STR_LIT:/>')<EOL>end_range = int(content_range[<NUM_LIT:0>])<EOL>blob_size = int(content_range[<NUM_LIT:1>])<EOL>if start_offset >= <NUM_LIT:16>:<EOL><INDENT>iv = content[:<NUM_LIT:16>]<EOL>content = content[<NUM_LIT:16>:]<EOL>start_offset -= <NUM_LIT:16><EOL><DEDENT>else:<EOL><INDENT>iv = encryption_data.content_encryption_IV<EOL><DEDENT>if end_range == blob_size - <NUM_LIT:1>:<EOL><INDENT>unpad = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>unpad = True<EOL>iv = encryption_data.content_encryption_IV<EOL><DEDENT>if blob_type == '<STR_LIT>':<EOL><INDENT>unpad = False<EOL><DEDENT>content_encryption_key = _validate_and_unwrap_cek(encryption_data, key_encryption_key, key_resolver)<EOL>cipher = _generate_AES_CBC_cipher(content_encryption_key, iv)<EOL>decryptor = cipher.decryptor()<EOL>content = decryptor.update(content) + decryptor.finalize()<EOL>if unpad:<EOL><INDENT>unpadder = PKCS7(<NUM_LIT>).unpadder()<EOL>content = unpadder.update(content) + unpadder.finalize()<EOL><DEDENT>return content[start_offset: len(content) - end_offset]<EOL>
Decrypts the given blob contents and returns only the requested range.

:param bool require_encryption:
    Whether or not the calling blob service requires objects to be decrypted.
:param object key_encryption_key:
    The user-provided key-encryption-key. Must implement the following methods:
    wrap_key(key)--wraps the specified key using an algorithm of the user's choice.
    get_key_wrap_algorithm()--returns the algorithm used to wrap the specified symmetric key.
    get_kid()--returns a string key id for this key-encryption-key.
:param key_resolver(kid):
    The user-provided key resolver. Uses the kid string to return a key-encryption-key 
    implementing the interface defined above.
:return: The decrypted blob content.
:rtype: bytes