docs: def ensure_regex_namespace(self, keyword: str, pattern: str) -> Namespace:
          """Get or create a regular expression namespace.
  
          :param keyword: The keyword of a regular expression namespace
          :param pattern: The pattern for a regular expression namespace
          """
          if pattern is None:
              raise ValueError('cannot have null pattern')
  
          namespace = self.get_namespace_by_keyword_pattern(keyword, pattern)
  
          if namespace is None:
              log.info('creating regex namespace: %s:%s', keyword, pattern)
              namespace = Namespace(
                  keyword=keyword,
                  pattern=pattern
              )
              self.session.add(namespace)
              self.session.commit()
  
          return namespace