from raven import Client

client = None

def get_client(ctx):
    if client:
        return client
    dsn = ctx.teuthology_config.get('sentry_dsn')
    if dsn:
        client = Client(dsn=dsn)
        return client


from raven import Client

client = None

def get_client(ctx):
    global client
    if client:
        return client
    dsn = ctx.teuthology_config.get('sentry_dsn')
    if dsn:
        client = Client(dsn=dsn)
        return client


Make client a global variable