[android] How do detect Android Tablets in general. Useragent?

Once I have detected Android in the user agent, this is how I differentiate between tablet and smartphone browsers (this is using Python, but is similarly simple for other programming languages):

if ("Android" in agent):
  if ("Mobile" in agent):
    deviceType = "Phone"
  else:
    deviceType = "Tablet"

UPDATED: to reflect use of Chrome on Android, as per comments below.