I'd consider modeling this modularity explicitly. You mention OAuth2, so for the sake of the example I'll assume the functionality you want to add is authentication using that protocol.
Then you'd have files like:
authmodule.py
import oauth2client
# ...
class OAuth2Module(object):
# ...
exampleclass.py
class ExampleClass(base_module.BaseHandler):
def __init__(self, auth_module, ...):
self.auth_module = auth_module
# ...
def foo(self):
if self.auth_module:
self.auth_module.bar()
main.py
# this is where ExampleClass is created
if use_option:
# the optional dependency only really gets pulled in here
from authmodule import AuthModule
example_obj = ExampleClass(AuthModule())
else:
example_obj = ExampleClass(None)
# ...
example_obj.foo()
Obviously this can be implemented a little differently, like moving the boilerplate from ExampleClass
into a DummyAuthModule
. (Can't really tell for sure seeing as it's not certain how the maybe-inherited class is used.)