<Directory> tag below (the directory then becomes the one in
  which the .htaccess file is located), and you will need to
  make sure the AllowOverride directive applicable to this
  directory has at least FileInfo specified. (The default is
  None, which will not work.)  
  
    <Directory /some/directory/htdocs/test> 
        AddHandler mod_python .py
        PythonHandler mptest 
        PythonDebug On 
    </Directory>
(Substitute /some/directory above for something applicable to your system, usually your Apache ServerRoot)
    from mod_python import apache
    def handler(req):
        req.write("Hello World!")
        return apache.OK