code: public static String validName(String name) {
          if (name == null || name.trim().isEmpty()) {
              return "unnamed";
          }
          StringBuilder result = new StringBuilder();
          for (char c : name.toCharArray()) {
              if (c == '_' || c == '.' || Character.isLetterOrDigit(c)) {
                  result.append(c);
              }
          }
          return result.toString();
      }
docs: Returns a valid name for variables
  
  @param name
  @return an name whose characters are in `[a-zA-Z_0-9.]`