code: public static void ensureValidNamespace(String namespace) throws InvalidNamespaceException {
          Pattern pattern = Pattern.compile("[^a-zA-Z0-9_\\.]");
          Matcher matcher = pattern.matcher(namespace);
          if (matcher.find()) {
              throw new InvalidNamespaceException();
          }
      }
docs: Ensures namespace is valid by ensuring it only has alphanumeric characters or the underscore
  for all characters in the string
  @param namespace