'Returns a global Context instance.
Most single-threaded applications have a single, global Context.
Use this method instead of passing around Context instances
throughout your code.
A common pattern for classes that depend on Contexts is to use
a default argument to enable programs with multiple Contexts
but not require the argument for simpler applications:
class MyClass(object):
def __init__(self, context=None):
self.context = context or Context.instance()'

@classmethod
def instance(cls, io_threads=1):

    if ((cls._instance is None) or cls._instance.closed):
        with cls._instance_lock:
            if ((cls._instance is None) or cls._instance.closed):
                cls._instance = cls(io_threads=io_threads)
    return cls._instance
