def query(self, metadata_name, options): # We can't do a query if we have no metadata of the requested type. if metadata_name not in self.metadata: raise ValueError("No \"%s\" metadata available for this corpus." % metadata_name) # Okay, we have this metadata type, neat! Do we have a query method for it? query_method = getattr(Importers.get_module_by_name(metadata_name), "query") if query_method is not None: return query_method(options) else: return None