def decrypt_fragment(fragment, frag_content):
    decrypt_info = fragment.get('decrypt_info')
    if ((not decrypt_info) or (decrypt_info['METHOD'] != 'AES-128')):
        return frag_content
    iv = (decrypt_info.get('IV') or compat_struct_pack('>8xq', fragment['media_sequence']))
    decrypt_info['KEY'] = (decrypt_info.get('KEY') or _get_key((info_dict.get('_decryption_key_url') or decrypt_info['URI'])))
    if self.params.get('test', False):
        return frag_content
    return unpad_pkcs7(aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv))
def decrypt_fragment(fragment, frag_content):
    decrypt_info = fragment.get('decrypt_info')
    if ((not decrypt_info) or (decrypt_info['METHOD'] != 'AES-128')):
        return frag_content
    iv = (decrypt_info.get('IV') or compat_struct_pack('>8xq', fragment['media_sequence']))
    decrypt_info['KEY'] = (decrypt_info.get('KEY') or _get_key((info_dict.get('_decryption_key_url') or decrypt_info['URI'])))
    if self.params.get('test', False):
        return frag_content
    return unpad_pkcs7(aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv))