def get_active_contexts():
 try:
  return list(_active_contexts.contexts)
 except AttributeError:
  return []

def get_active_contexts ( ) : try : return list ( _active_contexts . contexts ) except AttributeError : return [ ]
returns all the active contexts for the current thread .