def METHOD_NAME(data, key: bytes, encryption_algorithm, mac) -> str:
    if encryption_algorithm == PipelineD.HEConfig.RC4:
        cipher = ARC4.new(key)
        return cipher.decrypt(data).hex()
    hmac = HMAC.new(mac)
    if encryption_algorithm == PipelineD.HEConfig.AES256_CBC_HMAC_MD5:
        verify = data[0:32]
        hmac.update(codecs.decode(data[32:], 'hex_codec'))
        if hmac.hexdigest() != verify:
            return ""
        iv = codecs.decode(data[32:64], 'hex_codec')
        aes_cipher = AES.new(key, AES.MODE_CBC, iv)
        decrypted = aes_cipher.decrypt(codecs.decode(data[64:], 'hex_codec'))
        return decrypted.decode("utf-8").strip()
    elif encryption_algorithm == PipelineD.HEConfig.AES256_ECB_HMAC_MD5:
        verify = data[0:32]
        hmac.update(codecs.decode(data[32:], 'hex_codec'))
        if hmac.hexdigest() != verify:
            return ""
        aes_cipher = AES.new(key, AES.MODE_ECB)
        decrypted = aes_cipher.decrypt(codecs.decode(data[32:], 'hex_codec'))
        return decrypted.decode("utf-8").strip()
    elif encryption_algorithm == PipelineD.HEConfig.GZIPPED_AES256_ECB_SHA1:
        # Convert to hex str
        data = gzip.decompress(data).hex()
        verify = data[0:32]
        hmac.update(codecs.decode(data[32:], 'hex_codec'))
        if hmac.hexdigest() != verify:
            return ""
        aes_cipher = AES.new(key, AES.MODE_ECB)
        decrypted = aes_cipher.decrypt(codecs.decode(data[32:], 'hex_codec'))
        return decrypted.decode("utf-8").strip()
    raise ValueError("Unsupported encryption algorithm")