def toint(a):
    """ Convert string to int and also scale them accordingly if they end
    in "k", "m" or "b".
    """
    weights = {'k': 1000, 'm': 1000000, 'b': 1000000000}
    if len(a) > 1:
        if a[-1] in weights:
            return weights[a[-1]] * int(a[:-1])
    return int(a)