'Return the transform that maps from local coordinates to the item\'s ViewBox coordinates
If there is no ViewBox, return the scene transform.
Returns None if the item does not have a view.'

def viewTransform(self):

    view = self.getViewBox()
    if (view is None):
        return None
    if (hasattr(view, 'implements') and view.implements('ViewBox')):
        tr = self.itemTransform(view.innerSceneItem())
        if isinstance(tr, tuple):
            tr = tr[0]
        return tr
    else:
        return self.sceneTransform()
