Checks if event contains a file URL, accepts if it does, ignores if it doesn't

def _checkDragDropEvent(self, ev):
        """Checks if event contains a file URL, accepts if it does, ignores if it doesn't"""
        mimedata = ev.mimeData()
        if mimedata.hasUrls():
            urls = [str(url.toLocalFile()) for url in mimedata.urls() if url.toLocalFile()]
        else:
            urls = []
        # accept event if drag text is a file URL
        if urls:
            ev.acceptProposedAction()
            return urls
        else:
            ev.ignore()
            return None