Sometimes, calling some layout methods, results in sip being inable to downcast the items to their correct type, resulting only in a QgsLayoutItem object. This works around the problem, albeit in an incredibly hacky way.