def get_value(tl, key, **kwargs):
    """
        tl = [('k1','v11'),('k1','v12'),('k31','v3'),('k32','v3'),('k4','v41'),('k4','v42'),('k1','v13')]
        get_value(tl,'k1')
        get_value(tl,'k1',whiches=1)
        get_value(tl,'k1',whiches=[1,2])
        
    """
    single = False
    if 'mode' in kwargs:
        mode = kwargs['mode']
    else:
        mode = 'key'
    if 'whiches' in kwargs:
        whiches = kwargs['whiches']
    else:
        whiches = 'all'
    if isinstance(whiches, list):
        pass
    elif isinstance(whiches, int):
        single = True
        whiches = [whiches]
    else:
        pass
    length = tl.__len__()
    rslt = []
    cursor = 0
    for i in range(0, length):
        t = tl[i]
        k = t[0]
        v = t[1]
        if k == key:
            if whiches == 'all':
                cond = True
            else:
                cond = cursor in whiches
            if cond:
                if single == False:
                    rslt.append(v)
                else:
                    return v
            else:
                pass
            cursor = cursor + 1
        else:
            pass
    if single == True:
        raise KeyError(key)
    else:
        return rslt
