THRIFT-3596 Better conformance to PEP8

This closes #832
diff --git a/contrib/fb303/py/fb303/FacebookBase.py b/contrib/fb303/py/fb303/FacebookBase.py
index 685ff20..07db10c 100644
--- a/contrib/fb303/py/fb303/FacebookBase.py
+++ b/contrib/fb303/py/fb303/FacebookBase.py
@@ -24,59 +24,60 @@
 import thrift.reflection.limited
 from ttypes import fb_status
 
+
 class FacebookBase(FacebookService.Iface):
 
-  def __init__(self, name):
-    self.name = name
-    self.alive = int(time.time())
-    self.counters = {}
+    def __init__(self, name):
+        self.name = name
+        self.alive = int(time.time())
+        self.counters = {}
 
-  def getName(self, ):
-    return self.name
+    def getName(self, ):
+        return self.name
 
-  def getVersion(self, ):
-    return ''
+    def getVersion(self, ):
+        return ''
 
-  def getStatus(self, ):
-    return fb_status.ALIVE
+    def getStatus(self, ):
+        return fb_status.ALIVE
 
-  def getCounters(self):
-    return self.counters
+    def getCounters(self):
+        return self.counters
 
-  def resetCounter(self, key):
-    self.counters[key] = 0
+    def resetCounter(self, key):
+        self.counters[key] = 0
 
-  def getCounter(self, key):
-    if self.counters.has_key(key):
-      return self.counters[key]
-    return 0
+    def getCounter(self, key):
+        if self.counters.has_key(key):
+            return self.counters[key]
+        return 0
 
-  def incrementCounter(self, key):
-    self.counters[key] = self.getCounter(key) + 1
+    def incrementCounter(self, key):
+        self.counters[key] = self.getCounter(key) + 1
 
-  def setOption(self, key, value):
-    pass
+    def setOption(self, key, value):
+        pass
 
-  def getOption(self, key):
-    return ""
+    def getOption(self, key):
+        return ""
 
-  def getOptions(self):
-    return {}
+    def getOptions(self):
+        return {}
 
-  def getOptions(self):
-    return {}
+    def getOptions(self):
+        return {}
 
-  def aliveSince(self):
-    return self.alive
+    def aliveSince(self):
+        return self.alive
 
-  def getCpuProfile(self, duration):
-    return ""
+    def getCpuProfile(self, duration):
+        return ""
 
-  def getLimitedReflection(self):
-    return thrift.reflection.limited.Service()
+    def getLimitedReflection(self):
+        return thrift.reflection.limited.Service()
 
-  def reinitialize(self):
-    pass
+    def reinitialize(self):
+        pass
 
-  def shutdown(self):
-    pass
+    def shutdown(self):
+        pass
diff --git a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
index 4f8ce99..4b1c257 100644
--- a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
+++ b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
@@ -19,7 +19,8 @@
 # under the License.
 #
 
-import sys, os
+import sys
+import os
 from optparse import OptionParser
 
 from thrift.Thrift import *
@@ -31,11 +32,12 @@
 from fb303 import *
 from fb303.ttypes import *
 
+
 def service_ctrl(
-                 command,
-                 port,
-                 trans_factory = None,
-                 prot_factory = None):
+        command,
+        port,
+        trans_factory=None,
+        prot_factory=None):
     """
     service_ctrl is a generic function to execute standard fb303 functions
 
@@ -66,19 +68,19 @@
             return 3
 
     # scalar commands
-    if command in ["version","alive","name"]:
+    if command in ["version", "alive", "name"]:
         try:
-            result = fb303_wrapper(command,  port, trans_factory, prot_factory)
+            result = fb303_wrapper(command, port, trans_factory, prot_factory)
             print result
             return 0
         except:
-            print "failed to get ",command
+            print "failed to get ", command
             return 3
 
     # counters
     if command in ["counters"]:
         try:
-            counters = fb303_wrapper('counters',  port, trans_factory, prot_factory)
+            counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
             for counter in counters:
                 print "%s: %d" % (counter, counters[counter])
             return 0
@@ -86,11 +88,10 @@
             print "failed to get counters"
             return 3
 
-
     # Only root should be able to run the following commands
     if os.getuid() == 0:
         # async commands
-        if command in ["stop","reload"] :
+        if command in ["stop", "reload"]:
             try:
                 fb303_wrapper(command, port, trans_factory, prot_factory)
                 return 0
@@ -98,23 +99,21 @@
                 print "failed to tell the service to ", command
                 return 3
     else:
-        if command in ["stop","reload"]:
+        if command in ["stop", "reload"]:
             print "root privileges are required to stop or reload the service."
             return 4
 
     print "The following commands are available:"
-    for command in ["counters","name","version","alive","status"]:
+    for command in ["counters", "name", "version", "alive", "status"]:
         print "\t%s" % command
     print "The following commands are available for users with root privileges:"
-    for command in ["stop","reload"]:
+    for command in ["stop", "reload"]:
         print "\t%s" % command
 
+    return 0
 
 
-    return 0;
-
-
-def fb303_wrapper(command, port, trans_factory = None, prot_factory = None):
+def fb303_wrapper(command, port, trans_factory=None, prot_factory=None):
     sock = TSocket.TSocket('localhost', port)
 
     # use input transport factory if provided
@@ -179,11 +178,11 @@
 
     # parse command line options
     parser = OptionParser()
-    commands=["stop","counters","status","reload","version","name","alive"]
+    commands = ["stop", "counters", "status", "reload", "version", "name", "alive"]
 
     parser.add_option("-c", "--command", dest="command", help="execute this API",
                       choices=commands, default="status")
-    parser.add_option("-p","--port",dest="port",help="the service's port",
+    parser.add_option("-p", "--port", dest="port", help="the service's port",
                       default=9082)
 
     (options, args) = parser.parse_args()
diff --git a/contrib/fb303/py/setup.py b/contrib/fb303/py/setup.py
index 6710c8f..4321ce2 100644
--- a/contrib/fb303/py/setup.py
+++ b/contrib/fb303/py/setup.py
@@ -24,26 +24,25 @@
     from setuptools import setup, Extension
 except:
     from distutils.core import setup, Extension, Command
-        
-setup(name = 'thrift_fb303',
-    version = '1.0.0-dev',
-    description = 'Python bindings for the Apache Thrift FB303',
-    author = ['Thrift Developers'],
-    author_email = ['dev@thrift.apache.org'],
-    url = 'http://thrift.apache.org',
-    license = 'Apache License 2.0',
-    packages = [
-        'fb303',
-        'fb303_scripts',
-    ],
-    classifiers = [
-        'Development Status :: 5 - Production/Stable',
-        'Environment :: Console',
-        'Intended Audience :: Developers',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Topic :: Software Development :: Libraries',
-        'Topic :: System :: Networking'
-    ],
-)
 
+setup(name='thrift_fb303',
+      version='1.0.0-dev',
+      description='Python bindings for the Apache Thrift FB303',
+      author=['Thrift Developers'],
+      author_email=['dev@thrift.apache.org'],
+      url='http://thrift.apache.org',
+      license='Apache License 2.0',
+      packages=[
+          'fb303',
+          'fb303_scripts',
+      ],
+      classifiers=[
+          'Development Status :: 5 - Production/Stable',
+          'Environment :: Console',
+          'Intended Audience :: Developers',
+          'Programming Language :: Python',
+          'Programming Language :: Python :: 2',
+          'Topic :: Software Development :: Libraries',
+          'Topic :: System :: Networking'
+      ],
+      )