valid_proxy = None
while not valid_proxy:
random_item = random.randrange(0,len(config.PROXY))
random_proxy = config.PROXY[random_item]
if not is_bad_proxy(proxy_type,proxy):
valid_proxy = random_proxy
break
else:
del(config.PROXY[random_proxy])