import re
import socket

class Location(object):
  " Determine which cluster the code is running in, or CORP if we are not in prod. "

  CORP = "corp"

  @staticmethod
  def get_location():
    hostname = socket.gethostname()
    prod_matcher = re.match('^(\w{3}).*.twitter\.com$', hostname)

    if re.search('.+\.local$', hostname):
      return Location.CORP
    elif prod_matcher is not None:
      return prod_matcher.group(1)
    else:
      print 'Can\'t determine location (prod vs. corp). Hostname=%s' % hostname
      return None

@@ -45,17 +45,18 @@
 ct):%0A  %22
- 
+%22%22
 Determin
@@ -125,17 +125,18 @@
 in prod.
- 
+%22%22
 %22%0A%0A  COR
@@ -261,11 +261,15 @@
 w%7B3%7D
+%5Cd+
 ).*
+%5C
 .twi
@@ -295,39 +295,109 @@
 me)%0A
-%0A
     
-if re.searc
+prod_host = prod_matcher.group(1) if prod_matcher else None%0A    if hostname.endswit
 h('.
-+%5C.
 local
-$',
+') or
  hos
@@ -401,17 +401,69 @@
 hostname
-)
+.endswith('.office.twttr.net') or 'sfo0' == prod_host
 :%0A      
@@ -501,27 +501,12 @@
 rod_
-matcher is not None
+host
 :%0A  
@@ -521,32 +521,20 @@
 rn prod_
-matcher.group(1)
+host
 %0A    els

Update Location determination to current hostname standards.