<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getmodeldefinition(self, storageobject, required=False):
 """ find modeldefinition for StorageTableModel or StorageTableQuery """

        if isinstance(storageobject, StorageTableModel):
            definitionlist = [definition for definition in self._modeldefinitions if definition['modelname'] == storageobject.__class__.__name__]
     
        elif isinstance(storageobject, StorageTableQuery):
            """ StorageTableQuery """
            storagemodel = storageobject._storagemodel
            definitionlist = [definition for definition in self._modeldefinitions if definition['modelname'] == storagemodel.__class__.__name__]
        else:
            raise Exception("Argument is not an StorageTableModel nor an StorageTableQuery")
                                                                            
        # is there only one modeldefinition ?
        # hopefully!
        modeldefinition = None

        if len(definitionlist) == 1:
            modeldefinition = definitionlist[0]

        elif len(definitionlist) > 1:
            raise ModelRegisteredMoreThanOnceError(storageobject)

        # is there a modeldefinition if required ?
        if required and modeldefinition is None:
            raise ModelNotRegisteredError(storageobject)

        return modeldefinition