code: def is_valid_package_name(name, raise_error=False):
      
      is_valid = PACKAGE_NAME_REGEX.match(name)
      if raise_error and not is_valid:
          raise PackageRequestError("Not a valid package name: %r" % name)
      return is_valid
docs: Test the validity of a package name string.
  
      Args:
          name (str): Name to test.
          raise_error (bool): If True, raise an exception on failure
  
      Returns:
          bool.