Python Format Execute Function Only Once