def get_option_weights(options, default_weight=1):
    """Extract the weight of each option.

    Arguments:
    `options` -- the list of options, as provided by tokens2options()
    `default_weight` -- the default weight, to be used when weight is
        not specified. Defaults to 1.
    Returns:
    A list of integers with the weight of each option.
    """
    weights = []
    for opt_idx, opt_val in enumerate(options):
        weight = default_weight
        if len(opt_val) >= 3: # min length to have weight
            if opt_val[-2] == '%':
                weight = int(opt_val[-1])
                options[opt_idx] = opt_val[:-2]
        weights.append(weight)

    return weights