'Distributes the amount of locusts for each WebLocust-class according to it\'s weight
returns a list "bucket" with the weighted locusts'

def weight_locusts(self, amount, stop_timeout=None):

    bucket = []
    weight_sum = sum((locust.weight for locust in self.locust_classes if locust.task_set))
    for locust in self.locust_classes:
        if (not locust.task_set):
            warnings.warn(('Notice:    Found    Locust    class    (%s)    got    no    task_set.    Skipping...' % locust.__name__))
            continue
        if (self.host is not None):
            locust.host = self.host
        if (stop_timeout is not None):
            locust.stop_timeout = stop_timeout
        percent = (locust.weight / float(weight_sum))
        num_locusts = int(round((amount * percent)))
        bucket.extend([locust for x in xrange(0, num_locusts)])
    return bucket
