if '__main__' == __name__:
    with external_cm() as foo1:
        print('Location A')
print() 
with external_cm() as foo2:
    print('Location B')
raise Exception('Some exception occurs!!')
Writing a context manager in Python that itself uses a with statement