code: def lookup(self, query=''):
          
          res = []
          query = re.compile('.*%s.*' % re.escape(query), self.reflags)
          for name, email in self.get_contacts():
              if query.match(name) or query.match(email):
                  res.append((name, email))
          return res
docs: looks up all contacts where name or address match query