Api Development In Python Using Global Variables In Functions