define_module():  Check the module type for validity before using.
		  This reflects the changes made in
		  ../texinputs/python.sty.
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 12c7d0a..307944e 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -493,6 +493,12 @@
 sub define_module{
     my($word,$name) = @_;
     my $section_tag = join('', @curr_sec_id);
+    if ($word ne "built-in" && $word ne "extension"
+	&& $word ne "standard" && $word ne "") {
+	write_warnings("Bad module type '$word'"
+		       . " for \\declaremodule (module $name)");
+	$word = "";
+    }
     $word = "$word " if $word;
     $THIS_MODULE = "$name";
     $INDEX_SUBITEM = "(in $name)";