def select_action(dic_2d, dic_3d, action, twoD_source):
    """
    Construct sub-dictionaries by specifying which action to use
    
    Args
        dic_2d: dictionary containing 2d poses
        dic_3d: dictionary containing 3d poses
        action: the action to use
        twoD_source: how the key-points are generated (synthetic or real)
    Returns
        dic_2d_action: sub-dictionary containing 2d poses for the specified action
        dic_3d_action: sub-dictionary containing 3d poses for the specified action 
    """    
    dic_2d_action = {}
    dic_3d_action = {}
    for key in dic_2d.keys():
        if key[1] == action:
            dic_2d_action[key] = dic_2d[key].copy()
            if twoD_source == 'synthetic':
                key3d = key
            else:
                key3d = (key[0], key[1], key[2][:-3])
            dic_3d_action[key3d] = dic_3d[key3d].copy()    
    return dic_2d_action, dic_3d_action