code: def is_admin(self, send, nick, required_role='admin'):
          if not required_role:
              return True
          with self.db.session_scope() as session:
              admin = session.query(orm.Permissions).filter(orm.Permissions.nick == nick).first()
              if admin is None:
                  return False
              if required_role == "owner" and admin.role != "owner":
                  return False
              if not self.config['feature'].getboolean('nickserv'):
                  return True
              if not admin.registered:
                  self.update_authstatus(nick)
                  if send is not None:
                      send("Unverified admin: %s" % nick, target=self.config['core']['channel'])
                  return False
              else:
                  if not self.features['account-notify']:
                      if datetime.now() - admin.time > timedelta(minutes=5):
                          self.update_authstatus(nick)
                  return True