<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def registry(self, term=None):
 """List organizations and domains. When no term is given, the method will list the organizations existing in the registry. If 'term' is set, the method will list only those organizations and domains that match with that term. :param term: term to match """

        try:
            orgs = api.registry(self.db, term)
            self.display('organizations.tmpl', organizations=orgs)
        except NotFoundError as e:
            self.error(str(e))
            return e.code

        return CMD_SUCCESS