This all looks like it has to do with EC2 load-balancing. I think all this stuff should probably be in its own module, and just relatively imported where it's needed. What do you think?