Script will be useful, if you want to show different version of site for desktop computers and mobile devices. Big variety of methods to detect mobile type. Avaliable in different languages, including python. The port to python was made by me with help from my freelance customer.

Here how it can be used in django project:

from mobileesp import mdetect

user_agent = request.META.get("HTTP_USER_AGENT")
http_accept = request.META.get("HTTP_ACCEPT")
if user_agent and http_accept:
    agent = mdetect.UAgentInfo(userAgent=user_agent, httpAccept=http_accept)
    #Do first! For iPhone, Android, Windows Phone 7, etc.
    if agent.detectTierIphone():
    #Then catch all other mobile devices
    if agent.detectMobileQuick():
#For traditional computers and tablets (iPad, Android, etc.)
return HttpResponseRedirect('/myapp/d/')

Script on, all methods have comments with description.

Description at project site.